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(vanilla): Returning the same Promise twice from an atom getter causes Promise chaining cycle. #2152

Merged

Conversation

iwoplaza
Copy link
Contributor

@iwoplaza iwoplaza commented Sep 27, 2023

Related Issues or Discussions

Fixes #2151

Summary

Wrote a unit test reproducing this bug
image

Checking if the previous promise is different from the next before cancelling it fixes the issue.

Check List

  • yarn run prettier for formatting code and docs

@vercel
Copy link

vercel bot commented Sep 27, 2023

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 27, 2023 1:53pm

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 27, 2023

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 4369b53:

Sandbox Source
React Configuration
React TypeScript Configuration
React Browserify Configuration
React Snowpack Configuration
Next.js Configuration
Next.js with custom Babel config Configuration
React with custom Babel config Configuration

src/vanilla/store.ts Outdated Show resolved Hide resolved
Co-authored-by: Daishi Kato <[email protected]>
@iwoplaza
Copy link
Contributor Author

Tried the CodeSandbox CI build in our project where the bug was initially found, this change fixed the issue.

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.

LGTM
Thanks for your contribution!

@dai-shi dai-shi changed the title fix: Returning the same Promise twice from an atom getter causes Promise chaining cycle. fix(vanilla): Returning the same Promise twice from an atom getter causes Promise chaining cycle. Sep 27, 2023
@dai-shi
Copy link
Member

dai-shi commented Sep 27, 2023

It was a regression caused by #1933.

@dai-shi dai-shi added this to the v2.4.3 milestone Sep 27, 2023
@dai-shi dai-shi merged commit 2cfa5c7 into pmndrs:main Sep 27, 2023
@iwoplaza iwoplaza deleted the fix/vanilla/do-not-cancel-active-promise branch September 27, 2023 14:25
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