Open where you left off - #88
Merged
Merged
Conversation
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.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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), andrelaunch()goes throughrequest_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 onpagehide, which covers a webview torn down and brought back without going through either quit path.Window size and position needed nothing —
tauri-plugin-window-statealready writes those onRunEvent::Exit, and the restart path does emit it.Worth knowing
Testing
pnpm check,pnpm test(137 Rust tests) andpnpm test:e2e(336, including 8 new intests/e2e/session.spec.ts) all pass.