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

refactor(core): re-implement useAtom with useReducer #687

Merged
merged 11 commits into from
Sep 9, 2021

Conversation

dai-shi
Copy link
Member

@dai-shi dai-shi commented Sep 5, 2021

uMS won't land, #686 doesn't work so far.
I feel like simpler solution with useReducer would work better.
This simplifies a lot. Also, fixes weird issues in devtools.

@vercel
Copy link

vercel bot commented Sep 5, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pmndrs/jotai/9Zch3BP9tA21Q54SQWYs4oCEXuEL
✅ Preview: https://jotai-git-barely-use-reducer-pmndrs.vercel.app

@dai-shi
Copy link
Member Author

dai-shi commented Sep 5, 2021

This improves https://github.com/dai-shi/will-this-react-global-state-work-in-concurrent-rendering results:

v1.3.2

  jotai
    with useTransition
      ✓ test 1: updated properly with transition (3562 ms)
      ✓ test 2: no tearing with transition (122 ms)
      ✓ test 3: ability to interrupt render
      ✕ test 4: proper branching with transition (7543 ms)
    with intensive auto increment
      ✕ test 5: updated properly with auto increment (13214 ms)
      ✕ test 6: no tearing with auto increment (4 ms)

33a40b0

  jotai
    with useTransition
      ✓ test 1: updated properly with transition (3555 ms)
      ✓ test 2: no tearing with transition (119 ms)
      ✓ test 3: ability to interrupt render (1 ms)
      ✕ test 4: proper branching with transition (8503 ms)
    with intensive auto increment
      ✓ test 5: updated properly with auto increment (3233 ms)
      ✕ test 6: no tearing with auto increment (2 ms)

@dai-shi
Copy link
Member Author

dai-shi commented Sep 5, 2021

I would like to test if react devtools work before merging. (codesandbox ci is not working. 😓 )

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 5, 2021

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.

Latest deployment of this branch, based on commit 2e96c2c:

Sandbox Source
React Configuration
React Typescript Configuration
React Browserify Configuration
React Snowpack Configuration
Next.js Configuration

Co-authored-by: Mathis Møller <mmm@cryosinternational.com>
dai-shi and others added 2 commits September 8, 2021 20:32
Co-authored-by: Mathis Møller <mmm@cryosinternational.com>
Co-authored-by: Mathis Møller <mmm@cryosinternational.com>
Copy link
Collaborator

@Thisen Thisen left a comment

Choose a reason for hiding this comment

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

Looks good to me. Surprised that it didn't require test changes.

@dai-shi dai-shi merged commit c412d03 into main Sep 9, 2021
@dai-shi dai-shi deleted the barely-use-reducer branch September 9, 2021 00:24
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