Skip to content

Commit 7101474

Browse files
Rahul TyagiRahul Tyagi
authored andcommitted
feat: v0.3 persistence — collections, history, session restore
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.
1 parent a161b76 commit 7101474

11 files changed

Lines changed: 1699 additions & 449 deletions

File tree

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- **v0.3 — Persistence:** JSON store at `$OS_CONFIG_DIR/hypr/store.json`; data survives restart.
12+
- **Collections:** create named collections, save requests to them (name + target collection dialog),
13+
load saved requests into any tab with one click, delete collections and individual requests.
14+
- **History:** every sent request is recorded (method, URL, status, duration); shows in sidebar;
15+
click an entry to restore the URL into the active tab; auto-capped at 200 entries; clear-all action.
16+
- **Session restore:** open tabs (URL, method, headers, params, body, auth, settings) are persisted
17+
on every meaningful action and restored on the next launch.
18+
- **Sidebar:** collapsible left panel (toggle via `PanelLeftClose`/`PanelLeftOpen` icon) with
19+
Collections and History sections; each section independently collapsible.
20+
- Per-tab method and URL are now properly isolated — switching tabs restores each tab's method+URL
21+
(previously method and URL were shared across all tabs).
22+
- 5 new Go tests in `store_test.go` covering collection CRUD, request save/delete,
23+
history append/clear/cap, and session save/restore (total: 34 tests).
24+
25+
### Changed
26+
- Backend: added `Store` type backed by JSON, 10 new bound methods
27+
(`ListCollections`, `SaveCollection`, `DeleteCollection`, `SaveRequest`, `DeleteRequest`,
28+
`AppendHistory`, `ListHistory`, `ClearHistory`, `LoadSession`, `SaveSession`).
29+
- `App` struct gains a `store *Store` field initialized in `startup`; failure is non-fatal
30+
(app runs without persistence rather than crashing).
31+
- `KVPair`, `StoredAuth`, `TabState`, `SavedRequest`, `Collection`, `HistoryEntry`, `Session`
32+
Go types added to `store.go`.
33+
- Frontend layout changed from single-column scroll to sidebar + scrollable main area.
34+
- ESLint: `@typescript-eslint/no-empty-function` turned off (fire-and-forget `.catch(() => {})`
35+
is intentional for non-critical persistence calls).
36+
1037
### Added
1138
- Complete UI redesign on Tailwind CSS + shadcn/ui (Radix), with IBM Plex typography
1239
and a reusable component kit under `frontend/src/components/ui/`.

app.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
type App struct {
1616
ctx context.Context
1717
client *http.Client
18+
store *Store
1819
}
1920

2021
// NewApp creates a new App application struct
@@ -34,6 +35,13 @@ func (a *App) startup(ctx context.Context) {
3435
Transport: tr,
3536
}
3637
a.ctx = ctx
38+
39+
var err error
40+
a.store, err = newStore()
41+
if err != nil {
42+
// Non-fatal: app runs fine without persistence
43+
a.store = &Store{}
44+
}
3745
}
3846

3947
func doRequest(c *http.Client,

frontend/.eslintrc.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ module.exports = {
2020
'@typescript-eslint/no-explicit-any': 'off',
2121
// The React root element is known to exist.
2222
'@typescript-eslint/no-non-null-assertion': 'off',
23+
// Fire-and-forget .catch(() => {}) is intentional for non-critical persistence calls.
24+
'@typescript-eslint/no-empty-function': 'off',
2325
},
2426
}

0 commit comments

Comments
 (0)