Skip to content

Open where you left off - #88

Merged
MathiasWP merged 1 commit into
mainfrom
fiber-collision-probes
Aug 24, 2026
Merged

Open where you left off#88
MathiasWP merged 1 commit into
mainfrom
fiber-collision-probes

Conversation

@MathiasWP

Copy link
Copy Markdown
Owner

Collections, requests and responses were already durable. Everything about looking at them was not: the selected endpoint, both panes' tabs, the sidebar tab, which loader folders were expanded, and whatever had been typed into the scratch request. Every launch started on an empty scratch request with the sidebar back on Collections — a small thing after a deliberate quit, and a rude one after an auto-update restart nobody asked for.

All of it now lives in src/lib/session.svelte.ts: one JSON blob in local storage, restored synchronously before the first frame rather than from an effect after it, so the window opens as it was rather than visibly rearranging itself. A stored endpoint that no longer exists — deleted elsewhere, or dropped by a loader — falls back to the scratch request instead of leaving the pane blank.

An update restart also flushes the debounced section writes now. It never did: Rust holds an exit long enough for the frontend to save, but only for an exit it did not ask for itself (code: None), and relaunch() goes through request_restart() carrying a restart code that sails straight past that handler. The last few hundred milliseconds of edits went with the old process. The same flush runs on pagehide, which covers a webview torn down and brought back without going through either quit path.

Window size and position needed nothing — tauri-plugin-window-state already writes those on RunEvent::Exit, and the restart path does emit it.

Worth knowing

  • The scratch request's headers now sit in local storage in plaintext. Same exposure as a saved request's headers in its TOML file; keychain secrets are still only referenced, never copied. A scratch body over 256 KB is remembered as empty rather than risking the storage quota.
  • Still not restored: sidebar scroll position, the specific History entry that was open, and an endpoint past the sidebar's first 100-row page still needs scrolling to before its row mounts.

Testing

pnpm check, pnpm test (137 Rust tests) and pnpm test:e2e (336, including 8 new in tests/e2e/session.spec.ts) all pass.

Collections, requests and responses were already durable. Everything about
looking at them was not: the selected endpoint, both panes' tabs, the sidebar
tab, which loader folders were expanded, and whatever had been typed into the
scratch request. Every launch started on an empty scratch request with the
sidebar back on Collections — a small thing after a deliberate quit, and a rude
one after an auto-update restart nobody asked for.

All of it now lives in `session.svelte.ts`, one blob in local storage, restored
before the first frame rather than a moment after it, so the window opens as it
was rather than visibly rearranging itself. A stored endpoint that no longer
exists falls back to the scratch request rather than leaving the pane blank.

An update restart also flushes the debounced section writes now. It never did:
Rust holds an exit long enough for the frontend to save, but only for an exit it
did not ask for itself, and `relaunch` carries a restart code that sails past
that handler. The last few hundred milliseconds of edits went with the old
process. The same flush runs on `pagehide`, covering a webview torn down without
going through either quit path.

Window geometry needed nothing — tauri-plugin-window-state already writes it on
exit, and the restart path does run through exit.
@MathiasWP
MathiasWP merged commit e53e0b1 into main Aug 24, 2026
4 checks passed
@MathiasWP
MathiasWP deleted the fiber-collision-probes branch August 24, 2026 16:20
@github-actions github-actions Bot mentioned this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant