-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vltava - Data Binding using MatchMaker #1213
Closed
skylerjokiel
wants to merge
3
commits into
microsoft:master
from
skylerjokiel:aqueduct-container-modular
Closed
Vltava - Data Binding using MatchMaker #1213
skylerjokiel
wants to merge
3
commits into
microsoft:master
from
skylerjokiel:aqueduct-container-modular
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
skylerjokiel
requested review from
anthony-murphy,
ChumpChief,
sumedhb1995,
curtisman,
vladsud and
heliocliu
February 9, 2020 18:24
heliocliu
reviewed
Feb 10, 2020
closing this and will re-open with a different scenario since this doesn't really cover data-binding but more action binding which is something we don't necessarily want to promote as a pattern. |
This was referenced Nov 4, 2022
This was referenced Nov 4, 2022
This was referenced Nov 5, 2022
This was referenced Nov 5, 2022
This was referenced Nov 5, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR uses the MatchMaker container service to bind two new components: Number and Button.
Spaces also supports these component types, hard coded, so they work in there too.
Number
A component that shows a number. It can also registers with components that produce click events
Button
A components that doesn't contain any state but produces click events that other components listen for.
I actually attempted to make a ButtonFactory that was a container service that provided buttons since they are just ui elements that register. I think this is the right pattern but it would have required a lot of re-working how the component loading flow worked in tabs and I didn't want to commit to doing that so I simply made it a component with no backing data.
Notes
Since MatchMaker is at the Container level all buttons increment all numbers. This isn't great for this scenario but could be useful for other things. I have a plan for how to further scope discoverability and binding within a context.
Also MatchMaker requires components to be loaded before they are registered. This means that when you refresh the button will only increment components that have been viewed on the same page. This is the current behavior of Registro and was known when I wrote MatchMaker. This is okay behavior for a Component surface like Spaces that loads all components but with tabs it requires each tab to be opened. I have thoughts about a MatchMaker that stores handles to components that register with it. It will hydrate components if they are not initialized and someone is producing an event they care about.