Skip to content

Commit

Permalink
Merge pull request #538 from amelioro/fix-changes-lost-on-navigate-back
Browse files Browse the repository at this point in the history
fix: changes lost on navigate back
  • Loading branch information
keyserj authored Oct 20, 2024
2 parents 7763332 + e389fa1 commit a0d224d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/[username]/[topicTitle].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ const Topic: NextPage = () => {
const getDiagram = trpc.topic.getData.useQuery(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- `enabled` guarantees non-null before query is run
{ username: username!, title: topicTitle! },
// Not using stale time because client-side navigation back to this page fires the useEffect again,
// Zero stale time because client-side navigation back to this page fires the useEffect again,
// repopulating the store with old data (if the client changed data before navigating away & back).
// So we'll just re-fire on page mount, should be fine.
{ enabled: !!username && !!topicTitle },
{ enabled: !!username && !!topicTitle, staleTime: 0 },
);

const { sessionUser } = useSessionUser();
Expand Down

0 comments on commit a0d224d

Please sign in to comment.