Skip to content

Commit 0150c8d

Browse files
committed
feat: ✨ made initial content container invisible for errors as well
1 parent 7242d74 commit 0150c8d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

examples/basic/.perseus/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ pub fn run() -> Result<(), JsValue> {
9393
let initial_html = initial_container.inner_html();
9494
container_rx_elem.set_inner_html(&initial_html);
9595
initial_container.set_inner_html("");
96+
// Make the initial container invisible
97+
initial_container.set_attribute("style", "display: none;").unwrap();
9698
// Hydrate the error pages
9799
// Right now, we don't provide translators to any error pages that have come from the server
98100
error_pages.hydrate_page(&url, &status, &err, None, &container_rx_elem);

packages/perseus/src/shell.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ pub async fn app_shell(
229229
container_rx_elem.set_inner_html(&initial_html);
230230
initial_container.set_inner_html("");
231231
// Make the initial container invisible
232-
initial_container.set_attribute("style", "display: none;").unwrap();
232+
initial_container
233+
.set_attribute("style", "display: none;")
234+
.unwrap();
233235
checkpoint("page_visible");
234236
// Now that the user can see something, we can get the translator
235237
let mut translations_manager_mut = translations_manager.borrow_mut();
@@ -379,6 +381,10 @@ pub async fn app_shell(
379381
let initial_html = initial_container.inner_html();
380382
container_rx_elem.set_inner_html(&initial_html);
381383
initial_container.set_inner_html("");
384+
// Make the initial container invisible
385+
initial_container
386+
.set_attribute("style", "display: none;")
387+
.unwrap();
382388
// Hydrate the currently static error page
383389
// Right now, we don't provide translators to any error pages that have come from the server
384390
error_pages.hydrate_page(&url, &status, &err, None, &container_rx_elem);

0 commit comments

Comments
 (0)