From f7f6d1e382e39a28afc2e45baaf61159b6b22cc0 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Fri, 29 May 2026 17:25:53 +0200 Subject: [PATCH] feat(boards): wire board cache scope for query persistence Call setActiveQueryCacheBoardId when board context initializes so the client-side persister knows which board to scope cache reads/writes to. --- packages/boards/src/context.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/boards/src/context.tsx b/packages/boards/src/context.tsx index a099f64c7..24642b58d 100644 --- a/packages/boards/src/context.tsx +++ b/packages/boards/src/context.tsx @@ -6,6 +6,7 @@ import { usePathname } from "next/navigation"; import type { RouterOutputs } from "@homarr/api"; import { clientApi } from "@homarr/api/client"; +import { getActiveQueryCacheBoardId, setActiveQueryCacheBoardId } from "@homarr/api/query-cache"; import { updateBoardName } from "./updater"; @@ -28,6 +29,8 @@ export const BoardProvider = ({ }, ); + setActiveQueryCacheBoardId(data.id); + // Update the board name so it can be used within updateBoard method updateBoardName(initialBoard.name); @@ -42,6 +45,16 @@ export const BoardProvider = ({ }; }, [pathname, utils, initialBoard.name]); + useEffect(() => { + setActiveQueryCacheBoardId(data.id); + + return () => { + if (getActiveQueryCacheBoardId() === data.id) { + setActiveQueryCacheBoardId(null); + } + }; + }, [data.id]); + return (