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

select runs twice #3095

Closed
TkDodo opened this issue Dec 15, 2021 · 2 comments · Fixed by #3098
Closed

select runs twice #3095

TkDodo opened this issue Dec 15, 2021 · 2 comments · Fixed by #3098
Labels

Comments

@TkDodo
Copy link
Collaborator

TkDodo commented Dec 15, 2021

Describe the bug

a memoized select function runs twice under some circumstances, even though it should only run once.

circumstances:

  • query key stays the same
  • but select becomes a new value

Your Example Website or App

https://codesandbox.io/s/select-runs-twice-bf3pp

Steps to reproduce

  1. click the button
  2. observe the console.log - it should only execute select once.

Expected behavior

select should only be executed once per input

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

all

Additional context

if the query key changes with the input, select is correctly only executed once.

in this sandbox, I've only added input to the query key and things work:

https://codesandbox.io/s/select-runs-twice-forked-qrtqm?file=/src/App.tsx

@tannerlinsley
Copy link
Collaborator

🎉 This issue has been resolved in version 3.34.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tannerlinsley
Copy link
Collaborator

🎉 This issue has been resolved in version 4.0.0-alpha.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

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