Skip to content

feat: v0.3 persistence — collections, history, session restore#12

Merged
dropdevrahul merged 2 commits into
mainfrom
feat/v0.3-persistence
Jun 13, 2026
Merged

feat: v0.3 persistence — collections, history, session restore#12
dropdevrahul merged 2 commits into
mainfrom
feat/v0.3-persistence

Conversation

@dropdevrahul

Copy link
Copy Markdown
Owner

Summary

  • Collections — create named collections, save requests to them via a name + target dialog, load saved requests into any tab with one click, delete collections/requests.
  • History — every send is auto-recorded (method, URL, status, duration, timestamp); capped at 200 entries; click to restore URL; clear-all action.
  • Session restore — open tabs (method, URL, headers, params, body, auth, settings) persist across restarts; state is saved on meaningful actions and reloaded on launch.
  • Sidebar — collapsible left panel (toggle button in the top bar) with independent Collections and History sections.
  • Bug fix — method and URL are now per-tab; they were previously shared across all tabs, causing tab-switching to not restore the correct URL/method.

Backend changes

  • New store.go: Store type backed by a single JSON file at $OS_CONFIG_DIR/hypr/store.json; thread-safe via sync.Mutex.
  • Types: Collection, SavedRequest, HistoryEntry, Session, TabState, KVPair, StoredAuth.
  • 10 new bound Go methods: ListCollections, SaveCollection, DeleteCollection, SaveRequest, DeleteRequest, AppendHistory, ListHistory, ClearHistory, LoadSession, SaveSession.
  • App.store initialized in startup; failure is non-fatal (app runs without persistence).

Frontend changes

  • New components: sidebar.tsx, save-request-dialog.tsx.
  • New lib: store-types.ts (TypeScript interfaces for all store types).
  • App.tsx restructured to flex-row (sidebar + scrollable main).
  • Per-tab methods[]/urls[] arrays replace the previous shared request state.
  • Session saved via debounced SaveSession on tab changes, add/close, and after each send.
  • Wailsjs bindings updated (App.d.ts, App.js) with all 10 new methods.

Test plan

  • Launch app — session from last run is restored (correct URLs, methods, headers).
  • Create a collection, save the current request to it, reload app — request appears in sidebar.
  • Click a saved request in the sidebar — it loads into the active tab.
  • Send a request — it appears in History; click it to restore the URL.
  • Clear history — list empties.
  • Delete a collection — it disappears from the sidebar.
  • Add two tabs with different URLs, close and reopen — both tabs restore correctly.
  • go test ./... — 34 tests pass including 5 new store tests.

Rahul Tyagi added 2 commits June 13, 2026 20:40
Implements milestone v0.2 from docs/SPEC.md.

Backend
- Introduce structured RequestSpec (method, url, headers, body, settings)
  and a new Send(spec) bound method. Builds a per-request http.Client from
  Settings: timeout, follow-redirects (CheckRedirect), TLS verify.
- Extend RequestResult with Status, StatusText, DurationMs, SizeBytes.
- Non-JSON response bodies are now returned verbatim instead of dropped
  on json.Indent failure.
- Keep MakeRequest as a thin wrapper around Send for backward compat.
- Add SaveTextFile binding (used by Save body) via runtime.SaveFileDialog.
- New send_test.go covering: status/text round-trip, duration & size,
  timeout, TLS verify off, redirect-following off, JSON pretty + plain.

Frontend
- Response insight (A): status chip colored by HTTP class, duration,
  size formatter (B/KB/MB), Pretty/Raw body toggle, search-in-response
  with match count and <mark> highlighting, Copy & Save body buttons.
- Request power (B):
  - Query params builder, two-way synced with the URL field.
  - Auth: None / Bearer / Basic / API key (header or query target).
  - Body types: None / JSON (with Format button) / Form / Raw.
  - Per-request Settings: timeout, follow redirects, verify TLS.
  - Copy as cURL.
- Request editor reorganized into one tabbed panel (Headers / Params /
  Body / Auth / Settings).
- New shared helpers: kv (key/value rows), formatters, auth, settings,
  url-sync, curl-builder. Reusable KVRow replaces the per-purpose
  RequestHeader component (deleted).
- Wails bindings regenerated.

Deferred to v0.3 per spec: multipart / file uploads, iframe HTML preview.
Introduces a JSON store at $OS_CONFIG_DIR/hypr/store.json:

- Collections: create/rename/delete collections; save named requests to
  them via a dialog; load saved requests into the active tab with one click.
- History: every send is recorded (method, URL, status, duration); capped
  at 200 entries; click to restore URL into the active tab; clear-all.
- Session restore: open tabs (method, URL, headers, params, body, auth,
  settings) are persisted on each action and restored on launch.
- Sidebar: collapsible left panel with Collections + History sections.
- Fix: method and URL are now per-tab (were previously shared across tabs).
- 5 new store tests (34 total); all existing tests still pass.
- 10 new bound Go methods for the store; App.Store field non-fatally
  initialized so the app still runs if the config dir is unavailable.
@dropdevrahul dropdevrahul merged commit 358463c into main Jun 13, 2026
3 checks passed
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