Context selector status and plans? #73
Replies: 2 comments 1 reply
-
Experiment statusWe ran an experiment of the lazy propagation mechanism that showed mildly positive performance results, but we haven't run an experiment for context selectors yet. We're not really blocked by anything, it just hasn't been a priority while we work on other 18-related projects. API DesignThis is probably the biggest blocker that would prevent us from actually releasing it. The implementation details are mostly figured out, but API design space is vast. Again, this work is mostly on pause because we're busy with the 18 release. Release planIt's not a first-order priority for 18.0 because it doesn't block adoption of |
Beta Was this translation helpful? Give feedback.
-
The reason I updated that PR a few weeks ago is because some of our partners at Facebook were inquiring about the current status. It's not an active area of research right now, unfortunately — we're too busy with other 18 stuff, for now. |
Beta Was this translation helpful? Give feedback.
-
I see that @acdlite has recently revived the experimental "Context Selectors" PR at facebook/react#20646 , rebasing it on top of the latest changes.
I'm curious what the current state is of that feature, as well as potential plans for the API design. Since the PR is locked, I thought I'd open up a discussion here.
Questions:
Experiment Status
The PR was labeled as being for "internal experimentation only". How has that experimentation gone so far? Any particular insights? How has it been used?
API Design
The current API design in the PR relies on selectors that only directly return values extracted from the context value, rather than derived values:
with the reasoning being that it allows React to call those selectors during rendering with minimal perf overhead.
However, the PR also says "if this ever becomes stable it will likely differ".
Do you have a sense of how firm the current API design is? Any ideas what might change? What happens in the current design if users do provide selectors that derive values, and how would you prevent them from doing that? If the current design does stick around, where and how do you envision the "sufficiently smart compiler" coming into play, and would it be something official or from the community?
Release Plan
Overall, how likely is it that some form of context selectors will be in React 18.0, or in a later 18.x release?
I realize this is all still very WIP, and I don't want to try to force the team into predicting exact plans in the future. Just trying to get a sense of what the thinking is on this feature and where it's headed, with the understanding that things can change :)
Beta Was this translation helpful? Give feedback.
All reactions