-
Notifications
You must be signed in to change notification settings - Fork 262
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: contextual styled-jsx #721
Conversation
Draft the idea for moving style registry to react context for safety in concurrent mode. The APIs are not stabilized, feel free to share your opinions about it. |
9a4118e
to
969e505
Compare
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.
Thanks for putting this together @huozhi
I am afraid that the moment we introduce a configurable registry via context we open up the possibility to get into this issue #703 (comment) i.e. if you have multiple registries in the page the first one will pick up all the server side rendered style tags regardless of where they came from (which registry they belong to).
In general if you want styled-jsx to work with modern React you'll have to change quite a few things and it would be worth considering all the constraints and edge cases together (concurrent mode, streaming rendering, multiple registries/context etc).
Unfortunately I don't have time to do all this work on my spare time but if you all put together a detailed proposal/rfc I'd be happy to take a look.
fwiw the gist you found has flaws but I haven't had the time to iterate on it - I just made it public because I thought nobody would find it :)
9568893
to
9a2742e
Compare
9a2742e
to
443d6f0
Compare
5969020
to
1a4e35e
Compare
8df01c5
to
eaa5461
Compare
going to merge this PR into alpha branch to create a prerelease now. any further concern with this PR please leave comments I'll address them later 🙏 cc @giuseppeg |
Feature
This is the draft for contextual styled-jsx rendering idea from https://gist.github.com/giuseppeg/dc4cecdae1e9fcb4c5761712e75e9b93
Which would be a benefit for multi-requests case with concurrent mode on server side, metioned in #720 .
Each request will only use its own context to add/remove styles, to avoid having a shared style registry instance messed up on server side.
Use case
Closes #703
Closes #485
Closes #563