@@ -116,15 +116,21 @@ pub fn run() -> Result<(), JsValue> {
116
116
if let InitialState :: Error ( ErrorPageData { url, status, err } ) = get_initial_state( ) {
117
117
let initial_container = initial_container. unwrap( ) ;
118
118
// We need to move the server-rendered content from its current container to the reactive container (otherwise Sycamore can't work with it properly)
119
- let initial_html = initial_container. inner_html( ) ;
120
- container_rx_elem. set_inner_html( & initial_html) ;
119
+ // If we're not hydrating, there's no point in moving anything over, we'll just fully re-render
120
+ #[ cfg( feature = "hydrate" ) ]
121
+ {
122
+ let initial_html = initial_container. inner_html( ) ;
123
+ container_rx_elem. set_inner_html( & initial_html) ;
124
+ }
121
125
initial_container. set_inner_html( "" ) ;
122
126
// Make the initial container invisible
123
127
initial_container. set_attribute( "style" , "display: none;" ) . unwrap( ) ;
124
128
// Hydrate the error pages
125
129
// Right now, we don't provide translators to any error pages that have come from the server
126
130
error_pages. render_page( & url, & status, & err, None , & container_rx_elem) ;
127
131
} else {
132
+ // This is an error from navigating within the app (probably the dev mistyped a link...), so we'll clear the page
133
+ container_rx_elem. set_inner_html( "" ) ;
128
134
error_pages. render_page( "" , & 404 , "not found" , None , & container_rx_elem) ;
129
135
}
130
136
} ,
0 commit comments