-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor the Series and Collection data flow #302
Conversation
Simplify a lot of the logic in DataProvider by inverting the source of truth for Series and Collections. This change moves them from immutable props on DataProvider to separate children components which report their configuration (through the DataProvider's Context) into DataProvider's state. This allows DataProvider to be responsible for watching a lot fewer props and move the logic out to the separate components. Additionally, this ensures that the properties for Series and Collection are centrally-documented, due to them using TypeScript for their implementations. This also comes with some nice syntactic sugar around the grouping of Series into Collections (however, this is not required). Another benefit of this cleaned system is that the system can guarantee that Series and Collection objects which leave DataProvider are fully-populated. This will allow us to clean up default props littered throughout the codebase, for things like strokeWidth and color. Finally, in order to ease this massively-breaking API change, a thin backwards-compatibility shim has been introduced into DataProvider. However, this is not intended to be permanent and should be removed before the 0.5.0 stable version is released.
custom accessor support is coming
This required moving the calculated domains into the state
This leads to a crash if there aren't any series at all. Will fix later.
Because hey what's another commit on this branch, right?
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.
Overall it became so much better! gj
This is ready for review! Before merging, I'll squash all of these commits into something pretty. |
It should be shared between Series and Collection
6045f7a
to
fe7a22f
Compare
These are already covered by the Scatterplot stories but hey here we go
This required an update to Scaler where we need to handle the series props changing because they come in late.
[pr-server] |
There is one small known quirk with this PR -- I don't know if it's a regression or not. If you set I'm tempted to merge this anyway because it's very obscure, and the proper fix is much deeper -- and this PR is sprawling enough as it is. |
Simplify a lot of the logic in DataProvider by inverting the source of
truth for Series and Collections. This change moves them from immutable
props on DataProvider to separate children components which report their
configuration (through the DataProvider's Context) into DataProvider's
state. This allows DataProvider to be responsible for watching a lot
fewer props and move the logic out to the separate components.
Additionally, this ensures that the properties for Series and Collection
are centrally-documented, due to them using TypeScript for their
implementations. This also comes with some nice syntactic sugar around
the grouping of Series into Collections (however, this is not required).
Another benefit of this cleaned system is that the system can guarantee
that Series and Collection objects which leave DataProvider are
fully-populated. This will allow us to clean up default props littered
throughout the codebase, for things like strokeWidth and color.
Finally, in order to ease this massively-breaking API change, a thin
backwards-compatibility shim has been introduced into DataProvider.
However, this is not intended to be permanent and should be removed
before the 0.5.0 stable version is released.