T
TanStack2y ago
conscious-sapphire

Resetting InfiniteQuery on navigate replace

Hi! I have a form where one of the select fields uses useInfiniteQuery to populate the select items. On form submit, the page refreshes via useNavigate with replace: true and the form values as the search parameters. But if I check the field again after navigation, the items in the select field are the values of the next page of the useInfiniteQuery before I submitted the form. I was hoping to ask what I can try to maybe reset the query to the first page again when it navigates to the same page. Thank you! (I'm actually not sure if I should post this here or on Query)
2 Replies
harsh-harlequin
harsh-harlequin2y ago
Please put this into a minimally reproducible Stackblitz example, because it difficult to determine what the exact issue you facing without being able to try it out. You can create an example using our Router Stackblitz Starter
StackBlitz
Router Quickstart File Based Example - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
conscious-sapphire
conscious-sapphireOP2y ago
I managed to fix it already but thank you so much for responding! :heart:

Did you find this page helpful?