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
... Note: resources are only refreshed on route change. The router does not poll or update resources in the background. Navigation within the same route, e.g. query param change, will not trigger a refresh of resources.
The resource is not refreshed when the query is changed by;
Only way to force a refetch seems to be via an additional;
constresource=useResource(routeResource);// resource.refetch() forces a proper update
Then, in resource's getData function the query is not properly updated and only way to practically access it is via window.location, which is an implementation detail and should not be ideally used:
getData: (routerContext)=>{constparams=newURLSearchParams(window.location.search);constpage=params.get('page')||'1';// want to use page here, routerContext.query is a stale value from the previous route change for some reason}
Ideally I would expect it to get triggered for query param changes as well. As it has probably now became a public behaviour maybe we can do it behind a boolean option?
Even this is not implemented, routerContext should get properly updated before getData is called so that we have a workaround.
The text was updated successfully, but these errors were encountered:
Using a cache key that gets invalidated based on query parameter solves the issue. Still, updating documentation would be great. I will try to have a look if I can find the time.
As it is also implied by the documentation;
Only way to force a refetch seems to be via an additional;
Then, in resource's
getData
function the query is not properly updated and only way to practically access it is viawindow.location
, which is an implementation detail and should not be ideally used:Ideally I would expect it to get triggered for query param changes as well. As it has probably now became a public behaviour maybe we can do it behind a boolean option?
Even this is not implemented,
routerContext
should get properly updated beforegetData
is called so that we have a workaround.The text was updated successfully, but these errors were encountered: