TanStackT
TanStack9mo ago
4 replies
worthy-azure

invalidate data in router context

Hi,

I have data loaded and added to the router context to make it available on all pages
beforeLoad: async ({ context: { queryClient } }) => ({
    departments: await queryClient.ensureQueryData(departmentQueryOptions.list),
  }),


There is also a possibility to change that data (like adding a new department or updating an existing one).

How can I invalidate the data in the router context? router.invalidate() does not seem to work properly. I only see the new data after a page reload
Was this page helpful?