-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Hey, I found the issue with useSuspenseQuery, and I can't find a workaround for it yet, can you please help?
When I use useSuspenseQuery, everything works as expected when user navigates from another views,
but, if user navigates to the same view with different set of parameters, the useSuspenseQuery actually triggers the query, but do not update the data variable.
navigate from Home to Listing view:
const { data, loading, loaded } = useSuspenseQuery(query, variables);
render | loading | loaded | data
-------------------------------------------
1 | false | true | {data} - expected, very good, even loading=true was skipped
navigate from Listing to Listing with different variables, example page=2 or query="some search"
render | loading | loaded | data
-------------------------------------------
1 | false | true | {data} - the data variable has the old data yet. Despite the query was triggered in networking, and it has a new data arrived.
The data is never refreshed with a new array that came from the server.
Is user navigates away from the view and come back, the data refreshes as expected.
PS. I use const navigate = useNavigate(); navigate('new path'); for the navigation
Metadata
Metadata
Assignees
Labels
No labels