jotai icon indicating copy to clipboard operation
jotai copied to clipboard

Add tests for stale dependents

Open probeiuscorp opened this issue 1 year ago • 10 comments

Related Issues or Discussions

Fixes #2532

Summary

Add missing test case for conditional dependents receiving stale values since 59e04ab.

Check List

  • [x] yarn run prettier for formatting code and docs

probeiuscorp avatar Apr 30 '24 03:04 probeiuscorp

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jotai ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2024 1:54pm

vercel[bot] avatar Apr 30 '24 03:04 vercel[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codesandbox-ci[bot] avatar Apr 30 '24 03:04 codesandbox-ci[bot]

Add missing test case for conditional dependents receiving stale values since 59e04ab.

So, it's a regression in #2363 and v2.6.4.

dai-shi avatar Apr 30 '24 03:04 dai-shi

LiveCodes Preview in LiveCodes

Latest commit: 71942009caa9cb9bd98045b64a710b3779abfec1
Last updated: May 21, 2024 1:53pm (UTC)

Playground Link
React demo https://livecodes.io?x=id/9AHXWMS9P

See documentations for usage instructions.

github-actions[bot] avatar Apr 30 '24 03:04 github-actions[bot]

oops, #2535 wasn't enough...

hmm, is it really failing?

dai-shi avatar Apr 30 '24 04:04 dai-shi

Hi @samkline, if you are around, can you check this and see if you can fix store.ts?

dai-shi avatar May 01 '24 03:05 dai-shi

We need to fix this...

dai-shi avatar May 15 '24 01:05 dai-shi

I did some investigating and I believe the regression involves force in readAtomState.

2534-regression-diagnostics (text contents of image)

  • Column 1 is the test results before the regression (off of 2a25f039)
  • Column 2 is the test results after the regression (off of 1d7e6e3cf)
  • Column 3 is the test results after monkey-patching column 2's force to match column 1

My understanding is that force is the cause of this regression. Before the regression, in this test case, readAtomState is called with a force of undefined then true and then undefined but after the regression readAtomState is called with a force of undefined then undefined and then true. As demonstrated in column 3, simply changing force to match the old way seems to fix the regression.

(the test code)

probeiuscorp avatar May 15 '24 18:05 probeiuscorp

I did some investigating and I believe the regression involves force in readAtomState.

Nice finding.

simply changing force to match the old way seems to fix the regression.

I didn't follow everything. So, what's the suggested change?

dai-shi avatar May 19 '24 12:05 dai-shi

Sorry, it was a debugging change I made just for the test case (these lines) to learn whether force played a part in the regression. I don't have any code changes for production to fix the bug.

probeiuscorp avatar May 19 '24 12:05 probeiuscorp