persist the currently-selected project

This commit is contained in:
Kyle Corbitt
2023-08-09 16:45:05 -07:00
parent f70e73e338
commit 6c060c6ea0
2 changed files with 44 additions and 23 deletions

13
app/src/state/persist.ts Normal file
View 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,
}),
};