dai-shi / will-this-react-global-state-work-in-concurrent-rendering

Test tearing and branching in React concurrent rendering
MIT License
558 stars 45 forks source link

Tearing on update test failed #66

Closed oleggrishechkin closed 2 years ago

oleggrishechkin commented 2 years ago

Hi, @dai-shi

This is not an issue, but I see some strange behavior.

I'm testing my libs (external stores with useSyncExternalStore and batching via Promise.resolve()). I didn't see any tearing - all counters the same while test, but test failed.

If I notify subscribers synchronously - test will be succeed. If I change store value in microtask (at the same moment when I notify subscribers) - test will be succeed.

Should I trust test results or my eyes?

dai-shi commented 2 years ago

Hi, thanks for using the tool.

In general, do not fully trust the tool.

That said, if you stably see the failed test result, I would assume you can reproduce it with your hands and eyes.