Preact: 10.0.0 break context update with mobx.toJs usage

Created on 7 Oct 2019  路  1Comment  路  Source: preactjs/preact

After updating 10.0.0 child components can't observe store passed by context when mobx.toJs used in their parent.

explanation of example:

  1. MobX store passed into Context.Provider value in App component
  2. contenxt.store.count serialized & printed in Test component
  3. contenxt.store.count printed in Counter component
  4. user click button and compare clicks/raw value on your screen
  5. the values are the same for 10.0.0-rc.1 and differ for 10.0.0 release

error reproduction (cache cleaning may be required):
rc1: https://nuzsk.github.io/preact-x-consumer-bug/10.0.0-rc.1/dist/index.html
rel: https://nuzsk.github.io/preact-x-consumer-bug/10.0.0/dist/index.html
source:
https://github.com/Nuzsk/preact-x-consumer-bug

note: removing toJs allows the child component to update

Most helpful comment

Awesome, thanks a bunch for the repro cases and the source :+1: With it I was able to narrow down what's causing it and got a fix nearly ready :tada:

EDIT: Alright, that was easier than expected. The fix is ready :100:

>All comments

Awesome, thanks a bunch for the repro cases and the source :+1: With it I was able to narrow down what's causing it and got a fix nearly ready :tada:

EDIT: Alright, that was easier than expected. The fix is ready :100:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jescalan picture jescalan  路  3Comments

Zashy picture Zashy  路  3Comments

paulkatich picture paulkatich  路  3Comments

KnisterPeter picture KnisterPeter  路  3Comments

SabirAmeen picture SabirAmeen  路  3Comments