Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(open-knowledge): make the relaunch-to-install update banner non-dismissible (#1661)

Andrew Mikofalvy673fe4ff46e4
diff --git a/.changeset/fix-update-relaunch-banner-nondismissible.md b/.changeset/fix-update-relaunch-banner-nondismissible.md
new file mode 100644
index 000000000..1ba00e602
--- /dev/null
+++ b/.changeset/fix-update-relaunch-banner-nondismissible.md
@@ -0,0 +1,9 @@
+---
+"@inkeep/open-knowledge": patch
+"@inkeep/open-knowledge-core": patch
+"@inkeep/open-knowledge-server": patch
+"@inkeep/open-knowledge-app": patch
+"@inkeep/open-knowledge-desktop": patch
+---
+
+Remove the dismiss X from the "Relaunching to install the update…" banner. That card is a terminal in-progress state shown the instant Relaunch is clicked — there is nothing to dismiss, and the card already disappears when the app restarts, so a manual close would only hide live progress. The armed "Version X ready to install" card keeps its X (the user can still close it and relaunch later); only the post-click in-progress swap is now non-dismissible, via a new `dismissible` flag on the update-notice shape.
diff --git a/packages/app/src/components/UpdateNotices.dom.test.tsx b/packages/app/src/components/UpdateNotices.dom.test.tsx
new file mode 100644
index 000000000..2434638ff
--- /dev/null
+++ b/packages/app/src/components/UpdateNotices.dom.test.tsx
@@ -0,0 +1,56 @@
+import { afterEach, describe, expect, mock, test } from 'bun:test';
+import { cleanup, fireEvent, render, screen } from '@testing-library/react';
+import { NoticeCard } from './UpdateNotices';
+import { TOAST_A_PROGRESS_BODY, type UpdateNotice } from './UpdateNotices.shared';
+
+const DISMISS_NAME = 'Dismiss notice';
+
+describe('NoticeCard — dismiss X visibility', () => {
+ afterEach(() => {
+ cleanup();
+ });
+
+ test('a default notice renders the dismiss X and wires it to onDismiss', () => {
+ const notice: UpdateNotice = {
+ id: 'update-downloaded',
+ body: 'Version 1.2.3 ready to install',
+ priority: 2,
+ action: { label: 'Relaunch', onClick: () => {} },
+ };
+ const onDismiss = mock(() => {});
+ render(<NoticeCard notice={notice} onDismiss={onDismiss} />);
+
+ const x = screen.getByRole('button', { name: DISMISS_NAME });
+ fireEvent.click(x);
+ expect(onDismiss).toHaveBeenCalledTimes(1);
+ });
+
+ test('the in-progress relaunch card (dismissible: false) renders no dismiss X', () => {
+ const notice: UpdateNotice = {
+ id: 'update-downloaded',
+ body: TOAST_A_PROGRESS_BODY,
+ priority: 2,
+ dismissible: false,
+ };
+ render(<NoticeCard notice={notice} onDismiss={() => {}} />);
+
+ expect(screen.getByText(TOAST_A_PROGRESS_BODY)).toBeDefined();
+ expect(screen.queryByRole('button', { name: DISMISS_NAME })).toBeNull();
+ });
+
+ test('dismissible: false also drops the X in the stacked secondaryAction layout', () => {
+ const notice: UpdateNotice = {
+ id: 'two-action',
+ body: 'Decide something',
+ priority: 0,
+ dismissible: false,
+ action: { label: 'Continue', onClick: () => {} },
+ secondaryAction: { label: 'Stay', onClick: () => {} },
+ };
+ render(<NoticeCard notice={notice} onDismiss={() => {}} />);
+
+ expect(screen.queryByRole('button', { name: DISMISS_NAME })).toBeNull();
+ expect(screen.getByText('Continue')).toBeDefined();
+ expect(screen.getByText('Stay')).toBeDefined();
+ });
+});
diff --git a/packages/app/src/components/UpdateNotices.shared.ts b/packages/app/src/components/UpdateNotices.shared.ts
index d40f24d7e..f103694b8 100644
--- a/packages/app/src/components/UpdateNotices.shared.ts
+++ b/packages/app/src/components/UpdateNotices.shared.ts
@@ -37,6 +37,7 @@ export interface UpdateNotice {
onDismiss?: () => void;
variant?: 'info' | 'error';
priority: number;
+ dismissible?: boolean;
}
const PRIORITY_SCHEMA_INCOMPATIBILITY = 0;
@@ -76,6 +77,7 @@ export function attachUpdateSubscribers(
id: noticeId,
body: TOAST_A_PROGRESS_BODY,
priority: PRIORITY_UPDATE_DOWNLOADED,
+ dismissible: false,
});
bridge.update.relaunchNow().then(
() => {
diff --git a/packages/app/src/components/UpdateNotices.test.ts b/packages/app/src/components/UpdateNotices.test.ts
index 5d0485fd2..3caec62ea 100644
--- a/packages/app/src/components/UpdateNotices.test.ts
+++ b/packages/app/src/components/UpdateNotices.test.ts
@@ -191,6 +191,7 @@ describe('Notice A — ok:update:downloaded', () => {
expect(notice.action?.label).toBe(TOAST_A_ACTION);
expect(notice.variant).toBeUndefined();
expect(notice.priority).toBe(2); // update-downloaded = A
+ expect(notice.dismissible).toBeUndefined();
});
test('action onClick invokes bridge.update.relaunchNow', () => {
@@ -203,7 +204,7 @@ describe('Notice A — ok:update:downloaded', () => {
expect(bridge.update.relaunchNow).toHaveBeenCalledTimes(1);
});
- test('action onClick synchronously swaps Toast A in-place to a button-less in-progress card', () => {
+ test('action onClick synchronously swaps Toast A in-place to a button-less, non-dismissible in-progress card', () => {
const bridge = makeFakeBridge();
const addNotice = mock<(notice: UpdateNotice) => void>(() => {});
attachUpdateSubscribers(castBridge(bridge), addNotice);
@@ -215,6 +216,7 @@ describe('Notice A — ok:update:downloaded', () => {
expect(inProgress.body).toBe(TOAST_A_PROGRESS_BODY);
expect(inProgress.action).toBeUndefined();
expect(inProgress.priority).toBe(2);
+ expect(inProgress.dismissible).toBe(false);
});
test('relaunchNow rejection → error notice with appended detail + armed card restored for retry', async () => {
diff --git a/packages/app/src/components/UpdateNotices.tsx b/packages/app/src/components/UpdateNotices.tsx
index ec76b364c..5c4e3c36b 100644
--- a/packages/app/src/components/UpdateNotices.tsx
+++ b/packages/app/src/components/UpdateNotices.tsx
@@ -27,20 +27,21 @@ export {
WHATS_NEW_AUTO_DISMISS_MS,
} from './UpdateNotices.shared';
-function NoticeCard({ notice, onDismiss }: { notice: UpdateNotice; onDismiss: () => void }) {
+export function NoticeCard({ notice, onDismiss }: { notice: UpdateNotice; onDismiss: () => void }) {
const { t } = useLingui();
const borderTone = notice.variant === 'error' ? 'border-destructive/60' : 'border-sidebar-border';
- const dismissButton = (
- <Button
- variant="ghost"
- size="icon"
- className="size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground"
- aria-label={t`Dismiss notice`}
- onClick={onDismiss}
- >
- <X aria-hidden="true" className="size-3" />
- </Button>
- );
+ const dismissButton =
+ notice.dismissible === false ? null : (
+ <Button
+ variant="ghost"
+ size="icon"
+ className="size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground"
+ aria-label={t`Dismiss notice`}
+ onClick={onDismiss}
+ >
+ <X aria-hidden="true" className="size-3" />
+ </Button>
+ );
const actionButtonClass =
'shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground';