fix: address PR review — bugs, dead code, error handling

Critical fixes:
- Smart Home: invalidate entity state query after toggle mutation
- Beszel live mode: use 5s refetchInterval instead of global 30s
- Fix unit test assertions for 5-arg setQueryCacheAsync signature
- Fix serialize/deserialize mismatch: JSON.parse on read (matches persister's JSON.stringify)
- Remove render-time setActiveQueryCacheBoardId race (keep only useEffect)

Error handling:
- Log persistence errors instead of swallowing with catch(() => {})
- Log QueryCacheHydration failures with ErrorWithMetadata
- Beszel: log partial failures (system details, container stats)

Dead code removal:
- Remove dead queryKey from all 39 request handlers + lib files
- Delete unused Redis APIs: createCacheChannel, createChannelWithLatestAndEvents,
  createChannelEventHistory, history-channel.ts
- Remove stale createCacheChannel mock from docker test

Cleanup:
- Seed system-resources chart from initial query data (no empty start)
- Remove redundant refetchOnWindowFocus/refetchOnReconnect from BoardProvider
This commit is contained in:
Thomas Camlong committed 2026-06-25 11:25:09 +02:00
1 parent 457b1b0ce0
commit c4a664b7ac
50 files changed
+31 -254

No files matched your search

@@ -29,16 +29,6 @@ vi.mock("@homarr/request-handler/docker", () => ({
}),
},
}));
vi.mock("@homarr/redis", () => ({
createCacheChannel: () => ({
consumeAsync: async () => ({
timestamp: new Date().toISOString(),
data: { containers: [] },
}),
invalidateAsync: async () => {},
}),
}));
vi.mock("@homarr/docker/env", () => ({
env: {
ENABLE_DOCKER: true,
@@ -92,6 +92,7 @@ describe("queryCacheRouter", () => {
"board-1",
"cached-value",
expect.any(Number),
queryCacheMaxValueBytes,
);
await caller.removeItem({ boardId: "board-1" });
@@ -124,6 +125,7 @@ describe("queryCacheRouter", () => {
"board-1",
"cached-value",
expect.any(Number),
queryCacheMaxValueBytes,
);
});