Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(open-knowledge): calm sidebar reconnect during desktop relaunch (#1948)

Andrew Mikofalvyda0227f884e0
diff --git a/.changeset/relaunch-aware-sidebar-reconnect.md b/.changeset/relaunch-aware-sidebar-reconnect.md
new file mode 100644
index 000000000..71737cb93
--- /dev/null
+++ b/.changeset/relaunch-aware-sidebar-reconnect.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+The file sidebar no longer flashes a red "Could not reach server" error during a desktop auto-update relaunch. While the app restarts to install an update, the server is intentionally torn down for a few seconds — the sidebar now shows a calm "Relaunching to install the update…" notice instead, and quietly re-attempts the listing so it self-heals the moment the server returns (for example, when a relaunch is aborted). A genuine outage with no relaunch underway still surfaces the honest error immediately.
diff --git a/packages/app/src/components/FileTree.showall-lazy.dom.test.tsx b/packages/app/src/components/FileTree.showall-lazy.dom.test.tsx
index 7987be12c..96c9adfe3 100644
--- a/packages/app/src/components/FileTree.showall-lazy.dom.test.tsx
+++ b/packages/app/src/components/FileTree.showall-lazy.dom.test.tsx
@@ -250,6 +250,9 @@ mock.module('@pierre/trees/react', () => ({
}));
const { FileTree } = await import('./FileTree');
+const { attachRelaunchStateSubscribers, resetRelaunchStoreForTest } = await import(
+ '@/lib/relaunch-store'
+);
describe('FileTree showAll lazy root seed', () => {
let consoleWarnSpy: ReturnType<typeof spyOn>;
@@ -784,3 +787,123 @@ describe('FileTree showAll scoped refresh', () => {
expect(model.items.has('team/notes.md')).toBe(false);
});
});
+
+describe('FileTree relaunch-aware reconnect (desktop auto-update)', () => {
+ let consoleWarnSpy: ReturnType<typeof spyOn>;
+ let fireRelaunching: () => void;
+ let fireRelaunchFailed: () => void;
+ let detachRelaunch: () => void;
+
+ beforeEach(() => {
+ mergedConfig = { appearance: { sidebar: { showAllFiles: true } } };
+ showAllResponseFactory = () =>
+ jsonResponse({ documents: [docEntry('README')], truncated: false });
+ responseByUrl = new Map();
+ fetchUrls.length = 0;
+ model.items.clear();
+ model.listeners.clear();
+ model.focusedPath = null;
+ model.selectedPaths = [];
+ globalThis.fetch = makeFetchMock() as unknown as typeof fetch;
+ consoleWarnSpy = spyOn(console, 'warn').mockImplementation(() => {});
+ fireRelaunching = () => {};
+ fireRelaunchFailed = () => {};
+ detachRelaunch = attachRelaunchStateSubscribers({
+ onUpdateRelaunching: (cb: (info: { version: string }) => void) => {
+ fireRelaunching = () => cb({ version: '9.9.9' });
+ return () => {};
+ },
+ onUpdateRelaunchFailed: (cb: (info: { version: string; message?: string }) => void) => {
+ fireRelaunchFailed = () => cb({ version: '9.9.9', message: 'aborted' });
+ return () => {};
+ },
+ } as unknown as Parameters<typeof attachRelaunchStateSubscribers>[0]);
+ });
+
+ afterEach(() => {
+ cleanup();
+ detachRelaunch();
+ resetRelaunchStoreForTest();
+ consoleWarnSpy.mockRestore();
+ });
+
+ test('shows a calm relaunch notice instead of the red error while a relaunch is in flight', async () => {
+ render(<FileTree />);
+ await waitFor(() => expect(model.items.size).toBe(1));
+
+ showAllResponseFactory = () => {
+ throw new TypeError('Failed to fetch');
+ };
+ fireRelaunching();
+
+ await waitFor(() =>
+ expect(screen.getByRole('status').textContent ?? '').toContain(
+ 'Relaunching to install the update',
+ ),
+ );
+ expect(screen.queryByText('Could not reach server')).toBeNull();
+ expect(screen.queryByRole('alert')).toBeNull();
+ });
+
+ test('self-heals when the relaunch aborts and the server returns', async () => {
+ render(<FileTree />);
+ await waitFor(() => expect(model.items.size).toBe(1));
+
+ showAllResponseFactory = () => {
+ throw new TypeError('Failed to fetch');
+ };
+ fireRelaunching();
+ await waitFor(() =>
+ expect(screen.getByRole('status').textContent ?? '').toContain(
+ 'Relaunching to install the update',
+ ),
+ );
+
+ showAllResponseFactory = () =>
+ jsonResponse({ documents: [docEntry('README'), docEntry('AFTER')], truncated: false });
+ fireRelaunchFailed();
+
+ await waitFor(() => expect(model.items.has('AFTER.md')).toBe(true));
+ expect(screen.queryByRole('status')).toBeNull();
+ expect(screen.queryByText('Could not reach server')).toBeNull();
+ });
+
+ test('falls back to the honest error when reachability fails with no relaunch underway', async () => {
+ render(<FileTree />);
+ await waitFor(() => expect(model.items.size).toBe(1));
+
+ showAllResponseFactory = () => {
+ throw new TypeError('Failed to fetch');
+ };
+ emitDocumentsChanged(['files']);
+
+ await waitFor(() =>
+ expect(screen.getByRole('alert').textContent ?? '').toContain('Could not reach server'),
+ );
+ expect(screen.queryByText('Relaunching to install the update…')).toBeNull();
+ });
+
+ test('a lazy folder-children fetch failure during a relaunch shows the calm notice', async () => {
+ fireRelaunching();
+ showAllResponseFactory = () =>
+ jsonResponse({
+ documents: [folderEntry('team', true), docEntry('README')],
+ truncated: false,
+ });
+ responseByUrl.set(lazyDirUrl('team'), () => {
+ throw new TypeError('Failed to fetch');
+ });
+ render(<FileTree />);
+ await waitFor(() => expect(model.items.has('team/')).toBe(true));
+
+ model.getItem('team/')?.expand();
+
+ await waitFor(() =>
+ expect(screen.getByRole('status').textContent ?? '').toContain(
+ 'Relaunching to install the update',
+ ),
+ );
+ expect(screen.queryByText('Could not reach server')).toBeNull();
+ expect(screen.queryByRole('alert')).toBeNull();
+ });
+});
diff --git a/packages/app/src/components/FileTree.tsx b/packages/app/src/components/FileTree.tsx
index 59373ae35..988dd5c82 100644
--- a/packages/app/src/components/FileTree.tsx
+++ b/packages/app/src/components/FileTree.tsx
@@ -38,6 +38,7 @@ import {
FoldVertical,
Info,
Pencil,
+ RefreshCw,
SquarePen,
Trash2,
TriangleAlert,
@@ -183,6 +184,7 @@ import {
} from '@/lib/file-tree-menu-action-events';
import { parseServerResponse, parseSuccessOrWarn } from '@/lib/parse-server-response';
import { createRefreshScheduler } from '@/lib/refresh-scheduler';
+import { getRelaunchInFlightSnapshot, useRelaunchInFlight } from '@/lib/relaunch-store';
import {
consumeShowAllStream,
isNdjsonResponse,
@@ -330,6 +332,8 @@ const FILE_TREE_ROOT_DROP_CSS = `
const FILE_TREE_EXTERNAL_FILE_DROP_TARGET_ATTR = 'data-ok-external-file-drop-target';
const FILE_TREE_EXTERNAL_FILE_DROP_ROOT_ATTR = 'data-ok-external-file-drop-root-target';
const FILE_TREE_EXTERNAL_FILE_DROP_BUSY_PATH = '__external-file-drop__';
+
+const CONNECTIVITY_RECONNECT_RETRY_MS = 2000;
const FILE_TREE_EXTERNAL_FILE_DROP_CSS = `
[data-type="item"][${FILE_TREE_EXTERNAL_FILE_DROP_TARGET_ATTR}="true"] {
background: color-mix(in oklab, var(--color-primary) 10%, transparent);
@@ -1103,6 +1107,9 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
const [documents, setDocuments] = useState<FileEntry[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
+ const [reconnecting, setReconnecting] = useState(false);
+ const relaunchInFlight = useRelaunchInFlight();
+ const connectivityRetryTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const [truncatedShownCount, setTruncatedShownCount] = useState<number | null>(null);
const [busyPath, setBusyPath] = useState<string | null>(null);
const [deleteRequest, setDeleteRequest] = useState<FileTreeDeleteRequest | null>(null);
@@ -1206,6 +1213,48 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
const activeTargetRef = useRef(activeTarget);
const [emptyExternalFileDropActive, setEmptyExternalFileDropActive] = useState(false);
+ function clearConnectivityRetry() {
+ if (connectivityRetryTimerRef.current !== null) {
+ clearTimeout(connectivityRetryTimerRef.current);
+ connectivityRetryTimerRef.current = null;
+ }
+ }
+ function noteConnectivityRecovered() {
+ clearConnectivityRetry();
+ setReconnecting(false);
+ }
+ function reportServerReachableError(title: string) {
+ noteConnectivityRecovered();
+ setError(title);
+ }
+ function reportConnectivityFailure() {
+ clearConnectivityRetry();
+ if (getRelaunchInFlightSnapshot()) {
+ setError(null);
+ setReconnecting(true);
+ connectivityRetryTimerRef.current = setTimeout(() => {
+ connectivityRetryTimerRef.current = null;
+ refreshDocsScheduleRef.current?.();
+ }, CONNECTIVITY_RECONNECT_RETRY_MS);
+ return;
+ }
+ setReconnecting(false);
+ setError(t`Could not reach server`);
+ }
+
+ const isFirstRelaunchEffectRunRef = useRef(true);
+ // biome-ignore lint/correctness/useExhaustiveDependencies: relaunchInFlight is a transition trigger, not a read — the body calls the hoisted scheduler ref only. Sibling pattern at the showHiddenFiles / showAllFiles flip effects below.
+ useEffect(() => {
+ if (isFirstRelaunchEffectRunRef.current) {
+ isFirstRelaunchEffectRunRef.current = false;
+ return;
+ }
+ refreshDocsScheduleRef.current?.();
+ }, [relaunchInFlight]);
+
+ // biome-ignore lint/correctness/useExhaustiveDependencies: mount/unmount-only; see comment above.
+ useEffect(() => clearConnectivityRetry, []);
+
useEffect(() => {
if (loading || documents.length === 0) return;
const shadow = fileTreeHostRef.current?.querySelector(FILE_TREE_TAG_NAME)?.shadowRoot;
@@ -1461,13 +1510,13 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
}
if (controller.signal.aborted || generation !== lazyChildFetchGenerationRef.current) return;
if (result.kind === 'network-error') {
- setError(t`Could not reach server`);
+ reportConnectivityFailure();
console.warn('[FileTree] lazy folder children fetch failed:', folderTreePath, result.cause);
return;
}
if (result.kind === 'http-error') {
console.warn('[FileTree] lazy folder children http error:', folderTreePath, result.title);
- setError(result.title);
+ reportServerReachableError(result.title);
return;
}
const bypassClientDotDrop = showHiddenFilesRef.current || showAllFilesRef.current;
@@ -1477,6 +1526,7 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
spliceLazyFolderChildren(prev, folderTreePath, children, recentLocalAddsRef.current),
);
setError(null);
+ noteConnectivityRecovered();
if (result.truncated) setTruncatedShownCount(result.entries.length);
}
@@ -1751,6 +1801,7 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
};
}, []);
+ // biome-ignore lint/correctness/useExhaustiveDependencies: this is a once-per-`t` mount-lifecycle setup (it wires the refresh scheduler + listeners). The connectivity helpers it calls (reportConnectivityFailure / noteConnectivityRecovered) only touch refs + stable setters and close over the same `t` already in deps, so listing them would re-create the scheduler every render for no behavioral gain.
useEffect(() => {
let active = true;
let refreshController: AbortController | null = null;
@@ -1781,18 +1832,19 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
spliceLazyFolderChildren(prev, '', serverEntries, recentLocalAddsRef.current),
);
setError(null);
+ noteConnectivityRecovered();
setTruncatedShownCount(truncated ? entries.length : null);
revalidateExpandedLazyDirsRef.current();
} else {
const parsed = await parseServerResponse(res, t`Failed to load documents`);
if (!active) return;
if (!parsed.ok) {
- setError(parsed.title);
+ reportServerReachableError(parsed.title);
setTruncatedShownCount(null);
} else {
const success = DocumentListSuccessSchema.safeParse(parsed.body);
if (!success.success) {
- setError(t`Documents response did not match expected shape.`);
+ reportServerReachableError(t`Documents response did not match expected shape.`);
setTruncatedShownCount(null);
} else {
const bypassClientDotDrop = showHiddenFilesRef.current || showAll;
@@ -1813,6 +1865,7 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
setDocuments(merged);
}
setError(null);
+ noteConnectivityRecovered();
setTruncatedShownCount(
showAll && success.data.truncated === true ? success.data.documents.length : null,
);
@@ -1823,7 +1876,11 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
} catch (err) {
if (controller.signal.aborted) return;
if (active) {
- setError(err instanceof ShowAllStreamError ? err.message : t`Could not reach server`);
+ if (err instanceof ShowAllStreamError) {
+ reportServerReachableError(err.message);
+ } else {
+ reportConnectivityFailure();
+ }
}
console.warn('[FileTree] fetch failed:', err);
}
@@ -3246,11 +3303,28 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
return <FileTreeSkeleton />;
}
+ const reconnectNotice = reconnecting
+ ? relaunchInFlight
+ ? t`Relaunching to install the update…`
+ : t`Reconnecting…`
+ : null;
+
if (documents.length === 0) {
+ if (reconnectNotice !== null) {
+ return (
+ <div className="flex flex-1 items-center justify-center py-8">
+ <span role="status" className="select-none text-sidebar-foreground/50 text-sm">
+ {reconnectNotice}
+ </span>
+ </div>
+ );
+ }
if (error) {
return (
<div className="flex flex-1 items-center justify-center py-8">
- <span className="select-none text-sidebar-foreground/50 text-sm">{error}</span>
+ <span role="alert" className="select-none text-sidebar-foreground/50 text-sm">
+ {error}
+ </span>
</div>
);
}
@@ -3295,9 +3369,13 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
<div ref={fileTreeHostRef} className="flex min-h-0 flex-1 flex-col">
<PierreFileTree
header={
- (error || truncationNotice !== null) && (
+ (error || reconnectNotice !== null || truncationNotice !== null) && (
<>
- {error && <FileTreeHeaderNotice kind="error">{error}</FileTreeHeaderNotice>}
+ {reconnectNotice !== null ? (
+ <FileTreeHeaderNotice kind="reconnecting">{reconnectNotice}</FileTreeHeaderNotice>
+ ) : (
+ error && <FileTreeHeaderNotice kind="error">{error}</FileTreeHeaderNotice>
+ )}
{truncationNotice !== null && (
<FileTreeHeaderNotice kind="info">{truncationNotice}</FileTreeHeaderNotice>
)}
@@ -3499,8 +3577,14 @@ function FileTreeSkeleton() {
);
}
-function FileTreeHeaderNotice({ kind, children }: { kind: 'error' | 'info'; children: ReactNode }) {
- const Icon = kind === 'error' ? TriangleAlert : Info;
+function FileTreeHeaderNotice({
+ kind,
+ children,
+}: {
+ kind: 'error' | 'info' | 'reconnecting';
+ children: ReactNode;
+}) {
+ const Icon = kind === 'error' ? TriangleAlert : kind === 'reconnecting' ? RefreshCw : Info;
return (
<span
role={kind === 'error' ? 'alert' : 'status'}
@@ -3509,7 +3593,13 @@ function FileTreeHeaderNotice({ kind, children }: { kind: 'error' | 'info'; chil
kind === 'error' ? 'text-destructive' : 'text-muted-foreground',
)}
>
- <Icon aria-hidden="true" className="mt-0.5 size-3.5 shrink-0" />
+ <Icon
+ aria-hidden="true"
+ className={cn(
+ 'mt-0.5 size-3.5 shrink-0',
+ kind === 'reconnecting' && 'animate-spin motion-reduce:animate-none',
+ )}
+ />
<span className="min-w-0">{children}</span>
</span>
);
diff --git a/packages/app/src/lib/relaunch-store.test.ts b/packages/app/src/lib/relaunch-store.test.ts
new file mode 100644
index 000000000..137a9cf6c
--- /dev/null
+++ b/packages/app/src/lib/relaunch-store.test.ts
@@ -0,0 +1,99 @@
+import { afterEach, describe, expect, mock, test } from 'bun:test';
+
+const store = await import('./relaunch-store');
+
+type RelaunchingCb = (info: { version: string }) => void;
+type RelaunchFailedCb = (info: { version: string; message?: string }) => void;
+
+function makeBridge() {
+ let relaunching: RelaunchingCb = () => {};
+ let relaunchFailed: RelaunchFailedCb = () => {};
+ const bridge = {
+ onUpdateRelaunching: mock((cb: RelaunchingCb) => {
+ relaunching = cb;
+ return () => {
+ relaunching = () => {};
+ };
+ }),
+ onUpdateRelaunchFailed: mock((cb: RelaunchFailedCb) => {
+ relaunchFailed = cb;
+ return () => {
+ relaunchFailed = () => {};
+ };
+ }),
+ };
+ return {
+ bridge: bridge as unknown as Parameters<typeof store.attachRelaunchStateSubscribers>[0],
+ fireRelaunching: () => relaunching({ version: '9.9.9' }),
+ fireRelaunchFailed: () => relaunchFailed({ version: '9.9.9', message: 'aborted' }),
+ onRelaunching: bridge.onUpdateRelaunching,
+ onRelaunchFailed: bridge.onUpdateRelaunchFailed,
+ };
+}
+
+afterEach(() => {
+ store.resetRelaunchStoreForTest();
+ Reflect.deleteProperty(globalThis, 'window');
+});
+
+describe('relaunch-store', () => {
+ test('flips on relaunching, clears on relaunch-failed, and notifies subscribers', () => {
+ const { bridge, fireRelaunching, fireRelaunchFailed } = makeBridge();
+ const detach = store.attachRelaunchStateSubscribers(bridge);
+
+ expect(store.getRelaunchInFlightSnapshot()).toBe(false);
+
+ let notifications = 0;
+ const unsub = store.subscribeRelaunchInFlight(() => {
+ notifications += 1;
+ });
+
+ fireRelaunching();
+ expect(store.getRelaunchInFlightSnapshot()).toBe(true);
+ expect(notifications).toBe(1);
+
+ fireRelaunching();
+ expect(notifications).toBe(1);
+
+ fireRelaunchFailed();
+ expect(store.getRelaunchInFlightSnapshot()).toBe(false);
+ expect(notifications).toBe(2);
+
+ unsub();
+ detach();
+ });
+
+ test('detach severs the bridge subscriptions so later events are ignored', () => {
+ const { bridge, fireRelaunching } = makeBridge();
+ const detach = store.attachRelaunchStateSubscribers(bridge);
+ detach();
+
+ fireRelaunching();
+ expect(store.getRelaunchInFlightSnapshot()).toBe(false);
+ });
+});
+
+describe('installRelaunchStateBridge', () => {
+ test('no-op when window.okDesktop is undefined', () => {
+ Object.defineProperty(globalThis, 'window', {
+ configurable: true,
+ value: {} as Window & typeof globalThis,
+ });
+ expect(() => store.installRelaunchStateBridge()).not.toThrow();
+ });
+
+ test('subscribes once on the desktop bridge and is idempotent', () => {
+ const { bridge, onRelaunching, onRelaunchFailed } = makeBridge();
+ const testWindow = {} as Window & typeof globalThis;
+ Object.defineProperty(globalThis, 'window', { configurable: true, value: testWindow });
+ Object.defineProperty(testWindow, 'okDesktop', { configurable: true, value: bridge });
+
+ store.installRelaunchStateBridge();
+ expect(onRelaunching).toHaveBeenCalledTimes(1);
+ expect(onRelaunchFailed).toHaveBeenCalledTimes(1);
+
+ store.installRelaunchStateBridge();
+ expect(onRelaunching).toHaveBeenCalledTimes(1);
+ expect(onRelaunchFailed).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/packages/app/src/lib/relaunch-store.ts b/packages/app/src/lib/relaunch-store.ts
new file mode 100644
index 000000000..747d38bf5
--- /dev/null
+++ b/packages/app/src/lib/relaunch-store.ts
@@ -0,0 +1,58 @@
+import { useSyncExternalStore } from 'react';
+import type { OkDesktopBridge } from '@/lib/desktop-bridge-types';
+
+let relaunchInFlight = false;
+const listeners = new Set<() => void>();
+let attached = false;
+
+function notify(): void {
+ for (const l of listeners) l();
+}
+
+function setInFlight(next: boolean): void {
+ if (relaunchInFlight === next) return;
+ relaunchInFlight = next;
+ notify();
+}
+
+export function getRelaunchInFlightSnapshot(): boolean {
+ return relaunchInFlight;
+}
+
+export function subscribeRelaunchInFlight(listener: () => void): () => void {
+ listeners.add(listener);
+ return () => {
+ listeners.delete(listener);
+ };
+}
+
+export function attachRelaunchStateSubscribers(
+ bridge: Pick<OkDesktopBridge, 'onUpdateRelaunching' | 'onUpdateRelaunchFailed'>,
+): () => void {
+ const offs = [
+ bridge.onUpdateRelaunching(() => setInFlight(true)),
+ bridge.onUpdateRelaunchFailed(() => setInFlight(false)),
+ ];
+ return () => {
+ for (const off of offs) off();
+ };
+}
+
+export function installRelaunchStateBridge(): void {
+ if (attached) return;
+ if (typeof window === 'undefined') return;
+ const bridge = window.okDesktop;
+ if (!bridge) return;
+ attached = true;
+ attachRelaunchStateSubscribers(bridge);
+}
+
+export function useRelaunchInFlight(): boolean {
+ return useSyncExternalStore(subscribeRelaunchInFlight, getRelaunchInFlightSnapshot, () => false);
+}
+
+export function resetRelaunchStoreForTest(): void {
+ relaunchInFlight = false;
+ attached = false;
+ listeners.clear();
+}
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index a94a44f65..80aa3bf1d 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -31,6 +31,7 @@
"07gHun": ["You don't have access to this private repo. Sign in with an account that does."],
"07q4Qk": ["File sidebar"],
"092Wah": ["Enter a name for this template."],
+ "09Tv5j": ["Reconnecting…"],
"0BB9ID": ["No headings yet."],
"0Gd0NU": ["Shared"],
"0NA4b3": ["Keep my version"],
@@ -564,6 +565,7 @@
"GsBUCk": ["Loading settings"],
"GuqOb1": ["Failed to load headings"],
"Gx0VS1": ["e.g. drafts/ or *.draft.md"],
+ "H-vDm3": ["Relaunching to install the update…"],
"H0WlWQ": ["Grid of rows and columns with a header row."],
"H86f9p": ["Collapse"],
"H8Ng4Z": ["Search recent projects"],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index be0c11c39..40f1de21f 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -4407,6 +4407,10 @@ msgstr "Reconnected"
msgid "Reconnecting after server restart"
msgstr "Reconnecting after server restart"
+#: src/components/FileTree.tsx
+msgid "Reconnecting…"
+msgstr "Reconnecting…"
+
#: src/components/InstallInClaudeDesktopDialog.tsx
#: src/components/settings/SettingsDialogBody.tsx
msgid "Reinstall"
@@ -4429,6 +4433,10 @@ msgstr "Reject"
msgid "Relative path"
msgstr "Relative path"
+#: src/components/FileTree.tsx
+msgid "Relaunching to install the update…"
+msgstr "Relaunching to install the update…"
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Release notes"
msgstr "Release notes"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 9ad9bfe26..6628ae1c7 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -31,6 +31,7 @@
"07gHun": ["Ŷōũ ďōń'ţ ĥàvē àććēśś ţō ţĥĩś ƥŕĩvàţē ŕēƥō. Śĩĝń ĩń ŵĩţĥ àń àććōũńţ ţĥàţ ďōēś."],
"07q4Qk": ["Ƒĩĺē śĩďēƀàŕ"],
"092Wah": ["Ēńţēŕ à ńàḿē ƒōŕ ţĥĩś ţēḿƥĺàţē."],
+ "09Tv5j": ["Ŕēćōńńēćţĩńĝ…"],
"0BB9ID": ["Ńō ĥēàďĩńĝś ŷēţ."],
"0Gd0NU": ["Śĥàŕēď"],
"0NA4b3": ["Ķēēƥ ḿŷ vēŕśĩōń"],
@@ -564,6 +565,7 @@
"GsBUCk": ["Ĺōàďĩńĝ śēţţĩńĝś"],
"GuqOb1": ["Ƒàĩĺēď ţō ĺōàď ĥēàďĩńĝś"],
"Gx0VS1": ["ē.ĝ. ďŕàƒţś/ ōŕ *.ďŕàƒţ.ḿď"],
+ "H-vDm3": ["Ŕēĺàũńćĥĩńĝ ţō ĩńśţàĺĺ ţĥē ũƥďàţē…"],
"H0WlWQ": ["Ĝŕĩď ōƒ ŕōŵś àńď ćōĺũḿńś ŵĩţĥ à ĥēàďēŕ ŕōŵ."],
"H86f9p": ["Ćōĺĺàƥśē"],
"H8Ng4Z": ["Śēàŕćĥ ŕēćēńţ ƥŕōĴēćţś"],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index a016e4a56..d9d958f58 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -4402,6 +4402,10 @@ msgstr ""
msgid "Reconnecting after server restart"
msgstr ""
+#: src/components/FileTree.tsx
+msgid "Reconnecting…"
+msgstr ""
+
#: src/components/InstallInClaudeDesktopDialog.tsx
#: src/components/settings/SettingsDialogBody.tsx
msgid "Reinstall"
@@ -4424,6 +4428,10 @@ msgstr ""
msgid "Relative path"
msgstr ""
+#: src/components/FileTree.tsx
+msgid "Relaunching to install the update…"
+msgstr ""
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Release notes"
msgstr ""
diff --git a/packages/app/src/main.tsx b/packages/app/src/main.tsx
index 4e6a66176..bc0553d98 100644
--- a/packages/app/src/main.tsx
+++ b/packages/app/src/main.tsx
@@ -26,6 +26,7 @@ import {
installColdMountInstrumentation,
shouldInstallColdMountInstrumentation,
} from '@/lib/perf/cold-mount-instrumentation';
+import { installRelaunchStateBridge } from '@/lib/relaunch-store';
import { installShareReceivedListener } from '@/lib/share/receive-store';
import { seedInitialDocHashFromWindow } from '@/lib/single-file-initial-doc';
import { installUpdateNoticesBridge } from '@/lib/update-notices-store';
@@ -51,6 +52,8 @@ if (import.meta.env.DEV || import.meta.env.MODE === 'test') {
installUpdateNoticesBridge();
+installRelaunchStateBridge();
+
if (typeof window !== 'undefined') {
installDeepLinkListener({ bridge: window.okDesktop });
}
diff --git a/packages/app/src/presence/use-sync-toasts.ts b/packages/app/src/presence/use-sync-toasts.ts
index e92b44a7c..b07ca4bd2 100644
--- a/packages/app/src/presence/use-sync-toasts.ts
+++ b/packages/app/src/presence/use-sync-toasts.ts
@@ -1,12 +1,14 @@
import { useLingui } from '@lingui/react/macro';
import { useEffect, useRef } from 'react';
import { toast } from 'sonner';
+import { useRelaunchInFlight } from '@/lib/relaunch-store';
import type { SyncStatus } from './use-sync-status';
const TOAST_ID = 'sync-status';
export function useSyncToasts(status: SyncStatus, activeDocName: string | null) {
const { t } = useLingui();
+ const relaunchInFlight = useRelaunchInFlight();
const hasConnectedRef = useRef(false);
const wasDisconnectedRef = useRef(false);
@@ -26,6 +28,10 @@ export function useSyncToasts(status: SyncStatus, activeDocName: string | null)
}
if (status === 'disconnected' && hasConnectedRef.current) {
+ if (relaunchInFlight) {
+ toast.dismiss(TOAST_ID);
+ return;
+ }
wasDisconnectedRef.current = true;
toast.warning(
t`Connection lost \u2014 keep this tab open, your edits will sync when reconnected`,
@@ -35,5 +41,5 @@ export function useSyncToasts(status: SyncStatus, activeDocName: string | null)
wasDisconnectedRef.current = false;
toast.success(t`Reconnected`, { id: TOAST_ID, duration: 3000 });
}
- }, [status, activeDocName, t]);
+ }, [status, activeDocName, t, relaunchInFlight]);
}