feat: persist project selection
This commit is contained in:
37
.living_spec/specs/functional/PERSISTENCE.md
Normal file
37
.living_spec/specs/functional/PERSISTENCE.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Functional Spec: Persistence
|
||||
|
||||
## 1. Scope
|
||||
The application needs to persist user preferences and session state across restarts.
|
||||
The primary use case is remembering the **Last Opened Project**.
|
||||
|
||||
## 2. Storage Mechanism
|
||||
* **Library:** `tauri-plugin-store`
|
||||
* **File:** `store.json` (located in the App Data directory).
|
||||
* **Keys:**
|
||||
* `last_project_path`: String (Absolute path).
|
||||
* (Future) `theme`: String.
|
||||
* (Future) `recent_projects`: Array<String>.
|
||||
|
||||
## 3. Startup Logic
|
||||
1. **Backend Init:**
|
||||
* Load `store.json`.
|
||||
* Read `last_project_path`.
|
||||
* Verify path exists and is a directory.
|
||||
* If valid:
|
||||
* Update `SessionState`.
|
||||
* Return "Project Loaded" status to Frontend on init.
|
||||
* If invalid/missing:
|
||||
* Clear key.
|
||||
* Remain in `Idle` state.
|
||||
|
||||
## 4. Frontend Logic
|
||||
* **On Mount:**
|
||||
* Call `get_current_project()` command.
|
||||
* If returns path -> Show Workspace.
|
||||
* If returns null -> Show Selection Screen.
|
||||
* **On "Open Project":**
|
||||
* After successful open, save path to store.
|
||||
* **On "Close Project":**
|
||||
* Clear `SessionState`.
|
||||
* Remove `last_project_path` from store.
|
||||
* Show Selection Screen.
|
||||
Reference in New Issue
Block a user