File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import { Suspense } from "react" ;
44
5+ import { useSearchParams } from "next/navigation" ;
56import { ErrorBoundary } from "react-error-boundary" ;
67
78import { Spinner } from "@/components/ui" ;
89
910import { ErrorPage , SummonerContent } from "./_components" ;
1011
11- export default function SummonerPage ( ) {
12+ const ErrorBoundaryWithKey = ( ) => {
13+ const searchParams = useSearchParams ( ) ;
14+ const id = searchParams . get ( "id" ) ;
15+ const tag = searchParams . get ( "tag" ) ;
16+
1217 return (
13- < ErrorBoundary FallbackComponent = { ErrorPage } >
14- < Suspense
15- fallback = {
16- < div className = "flex h-96 w-full items-center justify-center" >
17- < Spinner />
18- </ div >
19- }
20- >
21- < SummonerContent />
22- </ Suspense >
18+ < ErrorBoundary FallbackComponent = { ErrorPage } key = { `${ id } -${ tag } ` } >
19+ < SummonerContent />
2320 </ ErrorBoundary >
2421 ) ;
22+ } ;
23+
24+ export default function SummonerPage ( ) {
25+ return (
26+ < Suspense
27+ fallback = {
28+ < div className = "flex h-96 w-full items-center justify-center" >
29+ < Spinner />
30+ </ div >
31+ }
32+ >
33+ < ErrorBoundaryWithKey />
34+ </ Suspense >
35+ ) ;
2536}
You can’t perform that action at this time.
0 commit comments