File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import type { AppProps } from 'next/app' ;
2+ import { ToastProvider } from '@/context/ToastContext' ;
3+ import '../app/globals.css' ;
4+
5+ export default function App ( { Component, pageProps } : AppProps ) {
6+ return (
7+ < ToastProvider >
8+ < Component { ...pageProps } />
9+ </ ToastProvider >
10+ ) ;
11+ }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export const persistenceLayer = {
1111 * Loads the state from IndexedDB.
1212 */
1313 async getItem ( name : string ) : Promise < string | null > {
14+ if ( typeof window === 'undefined' ) return null ;
1415 try {
1516 const db = await openDB ( DB_NAME , 1 , {
1617 upgrade ( db ) {
@@ -29,6 +30,7 @@ export const persistenceLayer = {
2930 * Saves the state to IndexedDB.
3031 */
3132 async setItem ( name : string , value : string ) : Promise < void > {
33+ if ( typeof window === 'undefined' ) return ;
3234 try {
3335 const db = await openDB ( DB_NAME , 1 , {
3436 upgrade ( db ) {
@@ -45,6 +47,7 @@ export const persistenceLayer = {
4547 * Removes the state from IndexedDB.
4648 */
4749 async removeItem ( name : string ) : Promise < void > {
50+ if ( typeof window === 'undefined' ) return ;
4851 const db = await openDB ( DB_NAME , 1 ) ;
4952 await db . delete ( STORE_NAME , name ) ;
5053 } ,
You can’t perform that action at this time.
0 commit comments