Skip to content

Commit 532aefa

Browse files
committed
fix(tauri): restore session state without listener delay
Start applying the loaded snapshot immediately, matching the Tauri behavior before desktop state was shared with Electron. Flush listeners are still registered eagerly, but their asynchronous setup no longer delays tab ordering and session hydration behind workspace startup. The focused source regression check now verifies both listeners remain registered without blocking restoration. UI typecheck and the targeted test pass.
1 parent 5f8d148 commit 532aefa

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

packages/ui/src/lib/hooks/use-app-session-capture.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import { describe, it } from "node:test"
55
const source = (file: string) => readFileSync(new URL(file, import.meta.url), "utf8")
66

77
describe("app session capture listener readiness", () => {
8-
it("waits for both Tauri flush listeners before restore starts capture", () => {
8+
it("registers both Tauri flush listeners without delaying restore", () => {
99
const capture = source("./use-app-session-capture.ts")
1010
const restore = source("./use-app-session-restore.ts")
1111
const ready = capture.slice(capture.indexOf("const ready ="), capture.indexOf("const markScrollAuthority"))
1212
assert.match(ready, /Promise\.all/)
1313
assert.match(ready, /client-state:flush-requested/)
1414
assert.match(ready, /client-state:navigation-flush-requested/)
15-
assert.ok(restore.indexOf("await capture.ready") < restore.indexOf("capture.start("))
15+
assert.doesNotMatch(restore, /await capture\.ready/)
1616
})
1717

1818
})

packages/ui/src/lib/hooks/use-app-session-restore.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ export function useAppSessionRestore(): void {
222222
const snapshot = loadedRestorableSession()
223223
void (async () => {
224224
try {
225-
await capture.ready
226225
if (!shouldRestoreSessionState(clientStateIsPrimary(), restorePreviousStateEnabled(), snapshot)) return capture.start()
227226
capture.start(snapshot!)
228227
await runAbortable(async (signal) => {

0 commit comments

Comments
 (0)