fix(web): реактивно переключать пространство через SpaceProvider
Docker / build (push) Failing after 18s
Docker / build (push) Failing after 18s
localStorage не вызывал re-render; useSpaceId + remount main по spaceId. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a61b352f0a
commit
c90b42c9c4
6 files changed
+84
-17
No files matched your search
@@ -7,11 +7,15 @@ export const snapshotKeys = {
|
||||
space: (spaceId: string | null) => ['snapshot', spaceId ?? 'default'] as const,
|
||||
}
|
||||
|
||||
export const snapshotQueryOptions = () => ({
|
||||
queryKey: snapshotKeys.space(getStoredSpaceId()),
|
||||
queryFn: () => api.fetchData(),
|
||||
staleTime: 30_000,
|
||||
})
|
||||
/** Pass spaceId from useSpaceId() so queryKey updates on switch. */
|
||||
export const snapshotQueryOptions = (spaceId?: string | null) => {
|
||||
const id = spaceId === undefined ? getStoredSpaceId() : spaceId
|
||||
return {
|
||||
queryKey: snapshotKeys.space(id),
|
||||
queryFn: () => api.fetchData(),
|
||||
staleTime: 30_000,
|
||||
}
|
||||
}
|
||||
|
||||
export const spacesKeys = {
|
||||
all: ['spaces'] as const,
|
||||
|
||||
Reference in new issue
Block a user