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

add test for unstable_derive #2665

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

dmaskasky
Copy link
Collaborator

@dmaskasky dmaskasky commented Jul 18, 2024

Summary

Adds test for unstable_derive store api.

a, b, c(a), d(c), e(d + b)
S1[d]: a0, b0, c0(a0), d1(c1(a1)), e0(d1(c1(a1)) + b0)

This new case tests both read and write for the combination of scoped and unscoped derived atoms indicated by the above configuration.

  1. a and b are primitive atoms.
  2. c, d, and e are derived atoms.
  3. c depends on a, d depends on c, and e depends on d and b.
  4. In the derivedStore (deriStore), only d is explicitly scoped.
  5. Because d is explicitly scoped, its dependency c is implicitly scoped.
  6. Implicitly scoped c's dependency a is also implicitly scoped.
  7. Because e is not scoped, e can read both explicitly scoped and not scoped dependencies d and b.

Check List

  • pnpm run prettier for formatting code and docs

Copy link

vercel bot commented Jul 18, 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 Jul 18, 2024 5:09pm

@dmaskasky dmaskasky requested a review from dai-shi July 18, 2024 17:08
Copy link

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

LiveCodes Preview in LiveCodes

Latest commit: 58c038e
Last updated: Jul 18, 2024 5:08pm (UTC)

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

See documentations for usage instructions.

@dai-shi dai-shi merged commit b30da26 into pmndrs:unstable_derive Jul 19, 2024
39 checks passed
dai-shi added a commit that referenced this pull request Aug 13, 2024
* experimental(core): expose unstable_derive instead of unstable_is

* chore: remove empty line

* chore types

* follow resolveAtom in #2609

* store test from #2609

* adjust store.test.tsx for unstable_derive

* limit atom state map type

* add test with atom state map

* update test using unstable_derive

* drop resolveAtom, add derive atom test

* simplify unstable_derive

* wip: this works but i do not like it

* separate atomstate and atomcontext

* for old ts

* fix

* fix 2

* simplify a bit with dev breaking changes

* revert to bd9c6c0, except for new test

* refactor (skipping the new test for now)

* refactor 2

* revert those refactors :-p

* wip: hm, how is bundle size?

* fix tests

* add test for unstable_derive (#2665)

* add a failing test

* wip: failed attempt

* split unstable_derive test

* wip: failed attempt 2

* revert failing tests

* empty commit

* restore unstable_is of now (we will remove it in the later version.)

---------

Co-authored-by: David Maskasky <[email protected]>
Co-authored-by: David Maskasky <[email protected]>
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