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.
This commit is contained in:
Thomas Camlong committed 2026-05-29 17:25:53 +02:00
1 parent 6c623a3a2d
commit f7f6d1e382
1 file changed
+13
+13
View File
@@ -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 (
<BoardContext.Provider
value={{