Skip to content
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
wants to merge 3 commits into from
Closed

Vltava - Data Binding using MatchMaker #1213

wants to merge 3 commits into from

Conversation

skylerjokiel
Copy link
Contributor

@skylerjokiel skylerjokiel commented Feb 9, 2020

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.

@skylerjokiel
Copy link
Contributor Author

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 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants