Skip to content

Commit 71ebdd3

Browse files
committed
Revert "fix(tauri): restore session state without listener delay"
This reverts commit 532aefa.
1 parent 532aefa commit 71ebdd3

2 files changed

Lines changed: 3 additions & 2 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("registers both Tauri flush listeners without delaying restore", () => {
8+
it("waits for both Tauri flush listeners before restore starts capture", () => {
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.doesNotMatch(restore, /await capture\.ready/)
15+
assert.ok(restore.indexOf("await capture.ready") < restore.indexOf("capture.start("))
1616
})
1717

1818
})

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

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

0 commit comments

Comments
 (0)