File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ export default function Page(props) {
3030 ) ;
3131 const content = isDynamicContent
3232 ? dynamicContent
33- : props . content . default || props . content ;
33+ : props . content && props . content . default !== undefined
34+ ? props . content . default
35+ : props . content ;
3436
3537 const [ contentLoaded , setContentLoaded ] = useState ( ! isDynamicContent ) ;
3638
@@ -41,7 +43,13 @@ export default function Page(props) {
4143 setContent ( ( ) => mod . default || mod ) ;
4244 setContentLoaded ( true ) ;
4345 } )
44- . catch ( ( ) => setContent ( "Error loading content." ) ) ;
46+ . catch ( ( ) => {
47+ setContent ( {
48+ __error : true ,
49+ message : "Failed to load page content." ,
50+ } ) ;
51+ setContentLoaded ( true ) ;
52+ } ) ;
4553 }
4654 } , [ props . content ] ) ;
4755
@@ -94,6 +102,10 @@ export default function Page(props) {
94102
95103 if ( typeof content === "function" ) {
96104 contentRender = content ( { } ) . props . children ;
105+ } else if ( content && content . __error ) {
106+ contentRender = (
107+ < div className = "text-red-600 font-bold" > { content . message } </ div >
108+ ) ;
97109 } else {
98110 contentRender = (
99111 < div
You can’t perform that action at this time.
0 commit comments