nanostores/query

[bug] create FetcherStore inside FC and it never get updates on react 18

sintell opened this issue · 1 comments

Example from Local state and Pagination does not work with react 18
I've made a quick example on codesandbox to reproduce this issue

Problem description:

useStore($fetcherStore) never returns an updated data, thou network call is completed successfully and Promise resolves without an error
So my component never re-renders with an actual data

What happens

I debugged it down to the store.notify() call, after calling set in here
When notify got called it has no currentListeners or nextListeners here so no one gets notified about the state change

I've checked that this is the case only for react 18 with new batching mode ON, so my guess it's somehow connected to the Automatic Batching feature

It is possible that actual problem lies somewhere in the upstream @nanostores but I could not figure out where to look next

Hope you could help and clarify this issue, thanks for the great lib by the way!

dkzlv commented

@sintell Thanks for your report, that's very helpful!

Fixed the issue in 0.0.5, here's a repro example on Stackblitz.