-
Notifications
You must be signed in to change notification settings - Fork 68
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
feat(widget): widget v2 #4789
Draft
Rathoz
wants to merge
34
commits into
squad-core-into-widget
Choose a base branch
from
widget-context
base: squad-core-into-widget
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
feat(widget): widget v2 #4789
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
Rathoz
force-pushed
the
widget-context
branch
from
September 24, 2024 08:54
361bbce
to
84ee0f9
Compare
hjpalpha
reviewed
Sep 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still some failed tests ;)
generally okay imo
The failed goldens are just a change from inline styling to css |
Rathoz
changed the title
refactor(widget): replace customizable with contexts
refactor(widget): widget v2
Sep 24, 2024
hjpalpha
reviewed
Sep 24, 2024
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.
Summary
Widget v2 contain two main changes.
Thanks to these changes in combination, the Inversion of Control becomes a lot better.
Contexts
Add support for the provider pattern, similiar to that of react in our Widgets. Contexts allow for a clearer hierarchy, and smooth implementations. Contexts allows for any data, allowing for, for instance, more specific data. One could make a context that implements just the content of the role cell on Infobox Person instead of having to do the entire cell, as an example instance, allowing for better fine-tuned control, and less broad overrides. Additionally it doesn't have the implementation overhead with injectors that more complex Widgets ran into.
Widget changes
The biggest changes:
render()
instead ofmake(children)
andmakeChildren(injector)
:getDerivedStateFromError()
)The impact and flexibility thanks to these changes makes a huge difference, especially the first one. The second one make the boilerplate needed to create a widget a lot smaller.
Squad
The PR also replaces the Squad feature to Widget v2
Code
This is how a wiki-custom for Squad render can look like
Future
Not super pleased with the context's default handling, but it works for now. The way it works here makes it very simple to convert existing customizables. Maybe for later
How did you test this change?
dev and busted