From 87b2c0cdcc7c108fa6cbdd15944070f27903528e Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Sat, 8 Aug 2026 23:24:13 +0200 Subject: [PATCH] fix(assistant): preserve lazy board boundaries --- .../nextjs/src/components/assistant/assistant-gate.tsx | 2 +- .../src/components/assistant/assistant-provider.tsx | 8 ++------ packages/api/src/router/test/widgets/calendar.spec.ts | 10 ++-------- packages/spotlight/package.json | 1 + packages/spotlight/src/index.ts | 5 ----- packages/spotlight/src/spotlight-store.ts | 1 + packages/widgets/package.json | 1 + 7 files changed, 8 insertions(+), 20 deletions(-) diff --git a/apps/nextjs/src/components/assistant/assistant-gate.tsx b/apps/nextjs/src/components/assistant/assistant-gate.tsx index b55e232f6..2a3ddbbb3 100644 --- a/apps/nextjs/src/components/assistant/assistant-gate.tsx +++ b/apps/nextjs/src/components/assistant/assistant-gate.tsx @@ -5,7 +5,7 @@ import { useMemo } from "react"; import dynamic from "next/dynamic"; import { useScopedI18n } from "@homarr/translation/client"; -import { AssistantWidgetRendererProvider } from "@homarr/widgets"; +import { AssistantWidgetRendererProvider } from "@homarr/widgets/assistant/context"; import { AssistantContext } from "./assistant-context"; import { AssistantBoardWidgetLazy } from "./assistant-widget-lazy"; diff --git a/apps/nextjs/src/components/assistant/assistant-provider.tsx b/apps/nextjs/src/components/assistant/assistant-provider.tsx index 8bdd1a5ef..b64415509 100644 --- a/apps/nextjs/src/components/assistant/assistant-provider.tsx +++ b/apps/nextjs/src/components/assistant/assistant-provider.tsx @@ -20,13 +20,9 @@ import { clientApi, fetchApi } from "@homarr/api/client"; import { createId } from "@homarr/common"; import { hotkeys } from "@homarr/definitions"; import { showErrorNotification, showWarningNotification } from "@homarr/notifications"; +import { closeSpotlight } from "@homarr/spotlight/store"; import { useScopedI18n } from "@homarr/translation/client"; -import { - closeSpotlight, - openMediaRequestSearch, - openSpotlight, - useRegisterSpotlightContextResults, -} from "@homarr/spotlight"; +import { openMediaRequestSearch, openSpotlight, useRegisterSpotlightContextResults } from "@homarr/spotlight"; import { AssistantWidgetRendererProvider } from "@homarr/widgets"; import { AssistantContext, AssistantPreferencesContext, useAssistantPreferences } from "./assistant-context"; diff --git a/packages/api/src/router/test/widgets/calendar.spec.ts b/packages/api/src/router/test/widgets/calendar.spec.ts index 7f0b04771..d83611451 100644 --- a/packages/api/src/router/test/widgets/calendar.spec.ts +++ b/packages/api/src/router/test/widgets/calendar.spec.ts @@ -92,7 +92,7 @@ describe("calendarRouter.findAllEvents", () => { ).rejects.toThrow(); }); - test("returns an integration-scoped error instead of silently dropping a failed calendar", async () => { + test("rejects the query when every selected calendar fails", async () => { const { caller, integrationId } = await createCallerAsync(); getDataAsync.mockRejectedValueOnce(new Error("remote calendar unavailable")); @@ -104,12 +104,6 @@ describe("calendarRouter.findAllEvents", () => { releaseType: ["inCinemas", "digitalRelease", "physicalRelease"], showUnmonitored: true, }), - ).resolves.toEqual([ - { - events: [], - integration: { id: integrationId, name: "Radarr", kind: "radarr" }, - error: "Calendar events could not be loaded from this integration.", - }, - ]); + ).rejects.toThrow("All integration queries failed"); }); }); diff --git a/packages/spotlight/package.json b/packages/spotlight/package.json index 7781ba78a..e70f9b418 100644 --- a/packages/spotlight/package.json +++ b/packages/spotlight/package.json @@ -15,6 +15,7 @@ ".": "./index.ts", "./component": "./src/component.ts", "./open": "./src/open.ts", + "./store": "./src/spotlight-store.ts", "./styles.css": "./src/styles.css" }, "scripts": { diff --git a/packages/spotlight/src/index.ts b/packages/spotlight/src/index.ts index 88ad028ea..706480f7c 100644 --- a/packages/spotlight/src/index.ts +++ b/packages/spotlight/src/index.ts @@ -1,13 +1,8 @@ "use client"; -import { spotlightActions } from "./spotlight-store"; - -export { Spotlight } from "./components/spotlight"; export { openSpotlight, openMediaRequestSearch, mediaRequestSearchEvent } from "./open"; export { SpotlightProvider, useRegisterSpotlightContextResults, useRegisterSpotlightContextActions, } from "./modes/home/context"; - -export const closeSpotlight = spotlightActions.close; diff --git a/packages/spotlight/src/spotlight-store.ts b/packages/spotlight/src/spotlight-store.ts index f1fc2cedc..44bea76c5 100644 --- a/packages/spotlight/src/spotlight-store.ts +++ b/packages/spotlight/src/spotlight-store.ts @@ -6,6 +6,7 @@ import { createSpotlight } from "@mantine/spotlight"; import { atom } from "jotai"; export const [spotlightStore, spotlightActions] = createSpotlight(); +export const closeSpotlight = spotlightActions.close; export interface MediaRequestSearchScope { integrationIds?: string[]; diff --git a/packages/widgets/package.json b/packages/widgets/package.json index d5d9740f2..0bf3bc8cb 100644 --- a/packages/widgets/package.json +++ b/packages/widgets/package.json @@ -17,6 +17,7 @@ "./custom-api/component": "./src/custom-api/component.tsx", "./custom-api/custom-jsx-display": "./src/custom-api/custom-jsx-display.tsx", "./custom-api/extract-display-data": "./src/custom-api/extract-display-data.ts", + "./assistant/context": "./src/assistant/context.tsx", "./catalog": "./src/catalog.ts", "./definition": "./src/definition.ts", "./errors": "./src/errors/component.tsx",