mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 05:51:47 +08:00
feat: add indexDB
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { create } from "zustand";
|
||||
import { combine, persist } from "zustand/middleware";
|
||||
import { combine, persist, createJSONStorage } from "zustand/middleware";
|
||||
import { Updater } from "../typing";
|
||||
import { deepClone } from "./clone";
|
||||
import { indexDBStorage } from "@/app/utils/indexDB-storage";
|
||||
|
||||
type SecondParam<T> = T extends (
|
||||
_f: infer _F,
|
||||
@@ -31,6 +32,7 @@ export function createPersistStore<T extends object, M>(
|
||||
) => M,
|
||||
persistOptions: SecondParam<typeof persist<T & M & MakeUpdater<T>>>,
|
||||
) {
|
||||
persistOptions.storage = createJSONStorage(() => indexDBStorage);
|
||||
return create(
|
||||
persist(
|
||||
combine(
|
||||
|
Reference in New Issue
Block a user