Notice that in the last consumer, value is not updated.
It seems to me that registration to the provider happens immediately after rendering a consumer. If changing the value of provider is done at the same time as conditionally rendering a consumer, the consumer won't pick the updated value.
Is the emitter not supposed to update the value when it registers?
I'm currently experiencing an issue when multiple consumers are conditionally rendered:
https://jsfiddle.net/jesusvilar/9h28gymb/36/
Notice that in the last consumer, value is not updated.
It seems to me that registration to the provider happens immediately after rendering a consumer. If changing the value of provider is done at the same time as conditionally rendering a consumer, the consumer won't pick the updated value.
Is the emitter not supposed to update the value when it registers?
https://github.com/valotas/preact-context/blob/master/src/context-value-emitter.ts#L20
Also, same jsfiddle using React 16: https://jsfiddle.net/jesusvilar/nLaqb7os/