Skip to content

Commit

Permalink
reset data_cache on goto
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecAivazis committed Apr 2, 2024
1 parent 2598f73 commit 135156b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/houdini-react/src/runtime/routing/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function Router({
injectToStream,
})
// if we get this far, it's safe to load the component
const { component_cache } = useRouterContext()
const { component_cache, data_cache } = useRouterContext()
const PageComponent = component_cache.get(page.id)!

// if we got this far then we're past the suspense
Expand Down Expand Up @@ -134,7 +134,12 @@ export function Router({
<LocationContext.Provider
value={{
pathname: currentURL,
goto: setCurrentURL,
goto: (url) => {
// clear the data cache so that we refetch queries with the new session (will force a cache-lookup)
data_cache.clear()

setCurrentURL(url)
},
params: variables ?? {},
}}
>
Expand Down

0 comments on commit 135156b

Please sign in to comment.