File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"use client" ;
22
3- import { useEffect , useState } from "react" ;
3+ import { useEffect , useState , Suspense } from "react" ;
44import { useSolidAuth } from "@ldo/solid-react" ;
55import { useSearchParams , useRouter , usePathname } from "next/navigation" ;
66import LoadingSpinner from "./shared/LoadingSpinner" ;
@@ -27,7 +27,7 @@ function hasSessionInStorage(): boolean {
2727 }
2828}
2929
30- export default function AuthWrapper ( { children } : AuthWrapperProps ) {
30+ function AuthWrapperContent ( { children } : AuthWrapperProps ) {
3131 const { session } = useSolidAuth ( ) ;
3232 const searchParams = useSearchParams ( ) ;
3333 const router = useRouter ( ) ;
@@ -138,3 +138,18 @@ export default function AuthWrapper({ children }: AuthWrapperProps) {
138138 // User is authenticated and on correct page, show the app
139139 return < > { children } </ > ;
140140}
141+
142+
143+ export default function AuthWrapper ( { children } : AuthWrapperProps ) {
144+ return (
145+ < Suspense
146+ fallback = {
147+ < div className = "flex min-h-screen items-center justify-center bg-white" >
148+ < LoadingSpinner size = "md" text = "Loading..." />
149+ </ div >
150+ }
151+ >
152+ < AuthWrapperContent > { children } </ AuthWrapperContent >
153+ </ Suspense >
154+ ) ;
155+ }
Original file line number Diff line number Diff line change @@ -5,18 +5,23 @@ import AuthWrapper from "./components/AuthWrapper";
55import LoadingSpinner from "./components/shared/LoadingSpinner" ;
66import FileManager from "./components/FileManager" ;
77
8+ // FileManagerContent uses useSearchParams, so it needs to be wrapped in Suspense
9+ function FileManagerContent ( ) {
10+ return < FileManager /> ;
11+ }
12+
813export default function Home ( ) {
914 return (
10- < Suspense
11- fallback = {
12- < AuthWrapper >
15+ < AuthWrapper >
16+ < Suspense
17+ fallback = {
1318 < div className = "flex min-h-screen items-center justify-center bg-white" >
1419 < LoadingSpinner size = "md" text = "Loading..." />
1520 </ div >
16- </ AuthWrapper >
17- }
18- >
19- < FileManager / >
20- </ Suspense >
21+ }
22+ >
23+ < FileManagerContent / >
24+ </ Suspense >
25+ </ AuthWrapper >
2126 ) ;
2227}
You can’t perform that action at this time.
0 commit comments