zero update propagation Context
See original GitHub issue(Documentation only) feature request
There is a set of cases, when you need to read context only once. Read without any future update, so no subscription is needed - mount effect
are a great example of this.
Some libraries already using this pattern, for example sweet-state
uses readContext
(“a hack”) to just get the data from React, in a same “no update” mode.
I think this pattern should be documented, but it seems a bit wrong to use useContext
to do so, as long as there are some expectations about how useContext
is working.
What do you think about useUntrackedContextSelector
? The same useContextSelector
, but “untracked”?
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
дэн on Twitter: "We want to fix the “deep update propagation ...
We want to fix the “deep update propagation” problem. But we don't want to pay the memory ... The new context API has...
Read more >React Context Does Not Propagate Changes to Other ...
Now multiple contexts cannot communicate with each other. The solution here is to make use of wrapRootElement api in gatsby-ssr.js and ...
Read more >The painful simplicity of context propagation in Go - YouTube
Context Propagation Part Deux: ctx context. Context in contextContext propagation is fundamental distributed tracing and modern observability ...
Read more >Context Propagation makes OpenTelemetry awesome
OpenTelemetry #observability #tracing #metrics #logs #architecture #tutorial #tedsuoContext Propagation is a fundamental part of ...
Read more >Trace Context - W3C
This specification includes editorial updates since the 6 February ... Trace context propagation passes along this unique identification.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Probably you are right, and I could solve the problem by creating two context - one with propagation, and another without. At least I would be able to use only built-in React functions. Or
readContext
hack.I understand your point. (I glanced react-sweet-state code using
readContext
before and I saw @JoviDeCroock 's code usingReact.useContext
for that purpose.)My preference is something like
useReadContext
. (no selector)However, I’m not sure if it should be a stable feature, because even if @gnoff 's RFC is accepted, this feature is not provided. (correct?) What do you think?