mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-23 02:16:08 +00:00
fix: check window existence before opening db
Prevent runtime errors by ensuring window is defined before attempting to open IndexedDB
This commit is contained in:
parent
75acdc9afb
commit
90fecdb565
@ -34,7 +34,7 @@ export interface ChatHistoryItem {
|
||||
|
||||
const persistenceEnabled = !import.meta.env.VITE_DISABLE_PERSISTENCE;
|
||||
|
||||
export const db = persistenceEnabled ? await openDatabase() : undefined;
|
||||
export const db = typeof window !== 'undefined' && persistenceEnabled ? await openDatabase() : undefined;
|
||||
|
||||
export const chatId = atom<string | undefined>(undefined);
|
||||
export const description = atom<string | undefined>(undefined);
|
||||
|
Loading…
Reference in New Issue
Block a user