feat: add Tauri state persistence and BvCli trait
- Add Tauri storage adapter for Zustand (tauri-storage.ts) - Add read_state, write_state, clear_state Tauri commands - Wire focus-store and nav-store to use Tauri persistence - Add BvCli trait for bv CLI mocking with response types - Add BvError and McError conversion for bv errors - Add cleanup_tmp_files tests for bridge - Fix linter-introduced tauri_specta::command issues Closes bd-2x6, bd-gil, bd-3px Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
*/
|
||||
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { persist, createJSONStorage } from "zustand/middleware";
|
||||
import { getStorage } from "@/lib/tauri-storage";
|
||||
import type { FocusAction, FocusItem } from "@/lib/types";
|
||||
|
||||
export interface FocusState {
|
||||
@@ -108,6 +109,7 @@ export const useFocusStore = create<FocusState>()(
|
||||
}),
|
||||
{
|
||||
name: "mc-focus-store",
|
||||
storage: createJSONStorage(() => getStorage()),
|
||||
partialize: (state) => ({
|
||||
current: state.current,
|
||||
queue: state.queue,
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
*/
|
||||
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { persist, createJSONStorage } from "zustand/middleware";
|
||||
import { getStorage } from "@/lib/tauri-storage";
|
||||
|
||||
export type ViewId = "focus" | "queue" | "inbox";
|
||||
|
||||
@@ -23,6 +24,7 @@ export const useNavStore = create<NavState>()(
|
||||
}),
|
||||
{
|
||||
name: "mc-nav-store",
|
||||
storage: createJSONStorage(() => getStorage()),
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user