-
-
Notifications
You must be signed in to change notification settings - Fork 651
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: micro-suspenses #3013
base: main
Are you sure you want to change the base?
fix: micro-suspenses #3013
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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. |
commit: |
|
Playground | Link |
---|---|
React demo | https://livecodes.io?x=id/CKNELUEEV |
See documentations for usage instructions.
src/react/useAtomValue.ts
Outdated
const value = store.get(atom) | ||
if (isPromiseLike(value)) { | ||
attachPromiseMeta(createContinuablePromise(value)) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems to work when we add a microtask delay.
Can we avoid having to add a delay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per this issue: #2848
Adding a delay is actually a workaround for a React 19 specific bug.
Though when I test around with it, seems like this is the actual part that fix it attachPromiseMeta(createContinuablePromise(value))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My gut feeling is that the fix isn't correct. But, I know atomWithObservable
is of hacks.
The test should be helpful. I'll check #2848 first.
Fixes #2848
I honestly don't understand why or how, so would need help with reviewing this. Worth noting this issue only happen with React 19.