-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
useDeferredValue
doesn't work with useSuspenseQuery
#10534
Comments
Hey @unbelivr 👋 ! Thanks so much for the feedback! If you want to avoid re-suspending a useSuspenseQuery(FILTERED_PEOPLE, {
suspensePolicy: 'initial',
variables: { name: filterDeferred }
}); I tried this on a fork of your codesandbox and this seems to work as you're expecting. That being said, there is a good chance the semantics of how this works may change between now and the final release. As you're doing here, I'd like to lean more on React's We'll try our best to keep you updated with changes to the API as we move through the alpha process. Appreciate you trying this out! |
Thanks @jerelmiller! The only drawback I see in This is what I'm trying to achieve with {filter !== filterDeferred && <p>Filtering...</p>} |
@unbelivr totally agree and something I also felt was a shortcoming of the current solution. |
Hey @unbelivr 👋 I just merged #10672 that fixes the compatibility with FYI the Thanks again for raising this issue and for trying out the alpha! This issue brought attention to several shortcomings of my previous solution. Once I have a fix for #10676, I plan to deprecate the |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
If some of query variables are deferred values and initial data was already recieved, component should not suspend and suspense fallback should not be displayed when I change these values.
Example in React Docs
At the moment, in the sandbox, when I change the filter value, the component suspends, so the list of names disappears and shows "Loading..." fallback. It should show "Filtering..." and current list instead.
Link to Reproduction
https://codesandbox.io/s/deferred-suspense-query-5g90bl
The text was updated successfully, but these errors were encountered: