From 9494fe599b1d52a64957bf22cc79976c20bee847 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 23 Oct 2023 10:06:58 +0100 Subject: [PATCH] goofy ahh nextjs --- src/store/IndexedDBStorage.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/store/IndexedDBStorage.ts b/src/store/IndexedDBStorage.ts index f9fe4c9..cf4aeda 100644 --- a/src/store/IndexedDBStorage.ts +++ b/src/store/IndexedDBStorage.ts @@ -1,9 +1,12 @@ "use client"; -import { createStore, del, get, set } from "idb-keyval"; +import { createStore, del, get, set, UseStore } from "idb-keyval"; import { StateStorage } from "zustand/middleware"; -const storage = createStore("scoresaber-reloaded", "storage"); +let storage: UseStore | undefined = undefined; +if (typeof window !== "undefined") { + storage = createStore("scoresaber-reloaded", "scoresaber"); +} export const IDBStorage: StateStorage = { getItem: async (name: string): Promise => {