File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export default function Page({ params }: { params: { id: string } }) {
17
17
}
18
18
19
19
try {
20
- await dbManager . closeDbInstance ( databaseId )
20
+ await dbManager . getDbInstance ( databaseId )
21
21
} catch ( err ) {
22
22
router . push ( '/' )
23
23
}
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ import { createClient } from '~/utils/supabase/client'
20
20
21
21
export type AppProps = PropsWithChildren
22
22
23
+ // Create a singleton DbManager that isn't exposed to double mounting
24
+ const dbManager = typeof window !== 'undefined' ? new DbManager ( ) : undefined
25
+
23
26
export default function AppProvider ( { children } : AppProps ) {
24
27
const [ isLoadingUser , setIsLoadingUser ] = useState ( true )
25
28
const [ user , setUser ] = useState < User > ( )
@@ -77,10 +80,6 @@ export default function AppProvider({ children }: AppProps) {
77
80
setUser ( undefined )
78
81
} , [ supabase ] )
79
82
80
- const dbManager = useMemo ( ( ) => {
81
- return typeof window !== 'undefined' ? new DbManager ( ) : undefined
82
- } , [ ] )
83
-
84
83
const isPreview = process . env . NEXT_PUBLIC_IS_PREVIEW === 'true'
85
84
const pgliteVersion = process . env . NEXT_PUBLIC_PGLITE_VERSION
86
85
const { value : pgVersion } = useAsyncMemo ( async ( ) => {
You can’t perform that action at this time.
0 commit comments