persist the currently-selected project
This commit is contained in:
13
app/src/state/persist.ts
Normal file
13
app/src/state/persist.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { PersistOptions } from "zustand/middleware/persist";
|
||||
import { State } from "./store";
|
||||
|
||||
export const stateToPersist = {
|
||||
selectedProjectId: null as string | null,
|
||||
};
|
||||
|
||||
export const persistOptions: PersistOptions<State, typeof stateToPersist> = {
|
||||
name: "persisted-app-store",
|
||||
partialize: (state) => ({
|
||||
selectedProjectId: state.selectedProjectId,
|
||||
}),
|
||||
};
|
||||
Reference in New Issue
Block a user