pmndrs / jotai

👻 Primitive and flexible state management for React
https://jotai.org
MIT License
18.63k stars 607 forks source link

Fix/unstable derive - add more tests #2751

Closed dmaskasky closed 1 month ago

dmaskasky commented 1 month ago

Summary

Adds failing test 😢

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

Adds more tests (passing) to https://github.com/pmndrs/jotai/pull/2741

  1. derived atom shares same implicit

    /**
    * a, b(a), c(a), d(a)
    * S1[b, c]: a0, b1(a1), c1(a1), d0(a0)
    */
  2. inherited atoms

    /**
    * a, b, c(a + b)
    * S1[a]: a1, b0, c0(a1 + b0)
    * S2[ ]: a1, b0, c0(a1 + b0)
    */
  3. 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)
    */
  4. 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

vercel[bot] commented 1 month ago

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
codesandbox-ci[bot] commented 1 month ago

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.

github-actions[bot] commented 1 month ago

LiveCodes Preview in LiveCodes

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

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

See documentations for usage instructions.