Skip to content

Possible bug in initiate() promise resolution timing #2645

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

Closed
markerikson opened this issue Aug 28, 2022 · 1 comment
Closed

Possible bug in initiate() promise resolution timing #2645

markerikson opened this issue Aug 28, 2022 · 1 comment
Milestone

Comments

@markerikson
Copy link
Collaborator

While testing upsertQueryData, I was doing something like this:

const fetchRes = dispatch(post.initiate('3'))
const upsertRes = dispatch(upsert('post', '3', {obj}))

await upsertRes;
expect(data).toEqual(upsertedData)

await fetchRes
expect(data).toEqual(fetchedData)

including a queryFn that was supposed to wait some delay before resolving.

Except it never worked. when I added a bunch of logging, the upsert did indeed update the state first, then the fetch, but somehow the upsertRes promise never resolved until the fetch update was complete. I couldn't figure out if it was a problem with my test code, or the "running promises" logic.

This may be related to #2477 / #2481 in some way, or it could be a different promises bug.

@markerikson markerikson added this to the 1.9 milestone Aug 28, 2022
@phryneas
Copy link
Member

Yeah... I think upsert promises need their completely independent handling there... drat.

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

No branches or pull requests

2 participants