You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using GraphQL and I'm changing the data with the React Query's select middleware. It should run only once per request, but it is running multiple times.
Steps To Reproduce
Use the useList hook
Add queryOptions.select: (data) => { console.log('select'); return data }
Hey @alicanerdurmaz , I was going to send it, but the contribution process seemed to require more time than I can afford at the moment...
We release a new version in the first week of every month. If you're not available, I can open a PR, or maybe someone else can do it. No problem, thank you!
Describe the bug
I'm using GraphQL and I'm changing the data with the React Query's
select
middleware. It should run only once per request, but it is running multiple times.Steps To Reproduce
useList
hookqueryOptions.select: (data) => { console.log('select'); return data }
Replication CodeSandbox: https://codesandbox.io/p/sandbox/react-query-5-forked-hh85pv
Expected behavior
It should run only once. In React Query's documentation, they say to memoize the select function: https://tanstack.com/query/latest/docs/framework/react/guides/render-optimizations#memoization
useList
is changing the function reference on every render.Packages
Additional Context
Possible fix: pass the
select
function inside auseCallback
touseList
'suseQuery
The text was updated successfully, but these errors were encountered: