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(core): return promise void on write atom and set #689

Merged
merged 3 commits into from
Sep 9, 2021

Conversation

dai-shi
Copy link
Member

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

close #685
close #607

This is partially reverting #508 change.

@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/8cEJgXJp1Y2DskNpKciJdmALYQA6
✅ Preview: https://jotai-git-write-atom-return-promise-pmndrs.vercel.app

@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 e851344:

Sandbox Source
React Configuration
React Typescript Configuration
React Browserify Configuration
React Snowpack Configuration
Next.js Configuration
jotai-await-async-set Issue #685

@dai-shi
Copy link
Member Author

dai-shi commented Sep 5, 2021

@acusti @mdtusz Could you please test you use cases with this PR.
https://ci.codesandbox.io/status/pmndrs/jotai/pr/689
Open this and find "Local Install Instructions".

@dai-shi
Copy link
Member Author

dai-shi commented Sep 5, 2021

@aulneau We discussed once about TypeScript issue regarding this, AFAIR.
typescript playground
This looks okay. Would you double check if this PR doesn't break your use case?

@acusti
Copy link

acusti commented Sep 7, 2021

@dai-shi i just installed the version from that link (https://pkg.csb.dev/pmndrs/jotai/commit/d8ea2e48/jotai) and it seems to do just what i need! i’m not sure about the implication of these changes and React.Suspense. should awaiting the result of calling the async write atoms write function from a useEffect hook or useCallback trigger the react suspense fallback? it didn’t in my testing when using it with useEffect, but i don’t know the expected behavior.

@dai-shi
Copy link
Member Author

dai-shi commented Sep 7, 2021

@acusti Thanks for the confirmation!

should awaiting the result of calling the async write atoms write function from a useEffect hook or useCallback trigger the react suspense fallback?

No, it will only suspend if you useAtom the async write atoms.

@dai-shi dai-shi requested a review from Thisen September 7, 2021 03:26
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.

Great change, made it more readable aswell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants