Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/unstable derive - add more tests #2751

Merged

Conversation

dmaskasky
Copy link
Collaborator

@dmaskasky dmaskasky commented Sep 26, 2024

Summary

Adds failing test 😢

  1. derived atom with subscribe
/**
 * a, b(a)
 * S1[a]: a1, b0(a1)
 */

Adds more tests (passing) to #2741

  1. derived atom shares same implicit
/**
 * a, b(a), c(a), d(a)
 * S1[b, c]: a0, b1(a1), c1(a1), d0(a0)
 */
  1. inherited atoms
/**
 * a, b, c(a + b)
 * S1[a]: a1, b0, c0(a1 + b0)
 * S2[ ]: a1, b0, c0(a1 + b0)
 */
  1. inherited atoms use explicit in current scope
/**
 * a, b, c(a + b)
 * S1[c]: a0, b0, c1(a1 + b1)
 * S2[a]: a0, b0, c1(a2 + b1)
 */
  1. uses implicit at any distance
/**
 * a, b(a), c(b), d(c), e(d)
 * S1[a]: a1, b0(a1), c0(b0(a1)), d0(c0(b0(a1))), e0(d0(c0(b0(a1))))
 * S1[b]: a0, b1(a1), c0(b1(a1)), d0(c0(b1(a1))), e0(d0(c0(b1(a1))))
 * S1[c]: a0, b0(a0), c1(b1(a1)), d0(c1(b1(a1))), e0(d0(c1(b1(a1))))
 * S1[d]: a0, b0(a0), c0(b0(a0)), d1(c1(b1(a1))), e0(d1(c1(b1(a1))))
 * S1[e]: a0, b0(a0), c0(b0(a0)), d0(c0(b0(a0))), e1(d1(c1(b1(a1))))
 */

Check List

  • pnpm run prettier for formatting code and docs

Copy link

vercel bot commented Sep 26, 2024

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 Sep 26, 2024 10:10pm

@dmaskasky dmaskasky changed the base branch from main to fix/unstable_derive September 26, 2024 21:37
Copy link

codesandbox-ci bot commented Sep 26, 2024

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.

Copy link

github-actions bot commented Sep 26, 2024

LiveCodes Preview in LiveCodes

Latest commit: 80f5807
Last updated: Sep 26, 2024 10:09pm (UTC)

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

See documentations for usage instructions.

@dmaskasky dmaskasky changed the title Fix/unstable derive more tests Fix/unstable derive - add more tests Sep 26, 2024
Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the failing test and more tests!
Merging to my branch.

derivedStore.sub(b, derivedCallback)
store.set(b, '*')
expect(store.get(b)).toBe('*')
expect(derivedStore.get(b)).toBe('a') // FIXME: received '*'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's because when subscribed, the store updates mounted atoms eagerly, so it makes sense to fail.
But, you made a small problem that I can understand. I will tackle it later.

@dai-shi dai-shi merged commit b1a5a08 into pmndrs:fix/unstable_derive Sep 27, 2024
24 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants