dyo / dyo

Dyo is a JavaScript library for building user interfaces.

Home Page:https://dyo.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Context consuming components are not auto-updated if they have memoized ancestor components

mcjazzyfunky opened this issue · comments

Please have a look at the following React demo:
https://codesandbox.io/s/zqzj7qwrx4

It outputs something like:

Last update: 10:50:36
Current counter value: 7

The important part is that the value "Last update" will NOT update,
while "Current counter value" is increasing each second.

If you have a look at the Dyo counterpart of this demo, you'll see
that "Current counter value" is NOT increasing there:
https://jsfiddle.net/ao8j2z9w/
I think this is a bug.

Oh, and btw: Is it intended that the context setter function
(= second return value of useContext) does NOT update (= re-render) the component?

v0.0.23 patches https://unpkg.com/dyo@0.0.23 this, the previous patch 0.0.22 didn't quite patch it well.

Oh, and btw: Is it intended that the context setter function
(= second return value of useContext) does NOT update (= re-render) the component?

Looks like a bug

Thanks for the test case. Looks like there was a bug in out-of-band(setInterval) updates for context. Patched in 0.0.25.

https://jsfiddle.net/q1thf46k/

Since it was a bug you probably don't need forceUpdate.

Great ... that was fast :)
Working as expected now ... and also no need for forceUpdate any longer.
I'll close this issue as everything seems fine now.

I'd leave this issue open until the code is pushed and tests are added