Skip to content

Commit

Permalink
fix(next-app-router): using wrong initial results when mounting on cl…
Browse files Browse the repository at this point in the history
…ient (#6099)
  • Loading branch information
aymeric-giraudet committed Mar 21, 2024
1 parent a8064b8 commit 8328b13
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react-instantsearch-nextjs/src/InstantSearchNext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export function InstantSearchNext<
const isMounting = useRef(true);
useEffect(() => {
isMounting.current = false;
return () => {
// This is to make sure that they're not reused if mounting again on a different route
delete window[InstantSearchInitialResults];
};
}, []);

const promiseRef = useRef<PromiseWithState<void> | null>(null);
Expand Down

0 comments on commit 8328b13

Please sign in to comment.