Skip to content

Commit 5ef4f6b

Browse files
committed
docs(home): note nuqs deferred-flush ordering in resource hash-strip
1 parent 88720d7 commit 5ef4f6b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/home

apps/sim/app/workspace/[workspaceId]/home/home.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ export function Home({ chatId, userName, userId }: HomeProps) {
8585
// mutates a query param via the History API.
8686
const setActiveResourceUrl = useCallback<Dispatch<SetStateAction<string | null>>>(
8787
(action) => {
88+
// Order matters: strip the fragment synchronously BEFORE the nuqs write.
89+
// nuqs re-appends `location.hash` on its (deferred) flush, so clearing the
90+
// hash first ensures the param write doesn't carry the stale fragment back.
8891
if (typeof window !== 'undefined' && window.location.hash) {
8992
const { pathname, search } = window.location
9093
window.history.replaceState(window.history.state, '', `${pathname}${search}`)

0 commit comments

Comments
 (0)