-
-
Notifications
You must be signed in to change notification settings - Fork 632
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: unwrap synchronously returns awaited values of resolved promise atoms #2880
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: |
Preview in LiveCodesLatest commit: 4efe200
See documentations for usage instructions. |
cf3a912
to
0913ff8
Compare
expect(store.get(syncAtom)).toBe(3) | ||
}) | ||
|
||
it('should unwrap to a fulfilled value of an already resolved async atom', async () => { | ||
const store = createStore() | ||
const asyncAtom = atom(Promise.resolve('concrete')) | ||
|
||
expect(await store.get(asyncAtom)).toEqual('concrete') | ||
expect(store.get(unwrap(asyncAtom))).toEqual(undefined) |
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.
This is the change in behavior.
90ac5e5
to
577ef67
Compare
577ef67
to
5b14751
Compare
5b14751
to
48cff68
Compare
48cff68
to
4efe200
Compare
Ohhhhh, my big apologies. This is not acceptable, but let's see if we have other solutions. |
Related Bug Reports or Discussions
#2877
Summary
Synchronously return atom values whose promises have already resolved.
Check List
pnpm run prettier
for formatting code and docs