Skip to content

Commit b5ba05d

Browse files
authored
Merge pull request #5462 from JuliusMoehring/main
fix: Avoid fetching prompts.json serverside
2 parents a8c70d8 + accb526 commit b5ba05d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/store/prompt.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Fuse from "fuse.js";
2-
import { getLang } from "../locales";
3-
import { StoreKey } from "../constant";
42
import { nanoid } from "nanoid";
3+
import { StoreKey } from "../constant";
4+
import { getLang } from "../locales";
55
import { createPersistStore } from "../utils/store";
66

77
export interface Prompt {
@@ -147,6 +147,11 @@ export const usePromptStore = createPersistStore(
147147
},
148148

149149
onRehydrateStorage(state) {
150+
// Skip store rehydration on server side
151+
if (typeof window === "undefined") {
152+
return;
153+
}
154+
150155
const PROMPT_URL = "./prompts.json";
151156

152157
type PromptList = Array<[string, string]>;

0 commit comments

Comments
 (0)