Skip to content

Commit

Permalink
vertigo_cli: Allow missing "head" element
Browse files Browse the repository at this point in the history
  • Loading branch information
sfisol committed Feb 28, 2024
1 parent c68a009 commit cc927df
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

* vertigo-cli: Don't html-escape styles embedded during SSR
* vertigo-cli: Don't panic when missing root html element
* vertigo-cli: Allow missing "head" element

## 0.4.2 - 2024-02-06

Expand Down
3 changes: 1 addition & 2 deletions crates/vertigo-cli/src/serve/html/html_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ impl HtmlResponse {
let head_exists = root_html.modify(&[("head", 0)], move |_head| {});

if !head_exists {
let message = "Missing <head> element".into();
return (StatusCode::INTERNAL_SERVER_ERROR, message);
log::info!("Missing <head> element");
}

let script = HtmlElement::new("script")
Expand Down
10 changes: 7 additions & 3 deletions demo/app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ mod app;
fn render() -> DomNode {
let Some(ws_chat) = get_driver().env("ws_chat") else {
return dom! {
<div>
"The ws_chat variable env is missing"
</div>
<html>
<body>
<div>
"The ws_chat variable env is missing"
</div>
</body>
</html>
}
};

Expand Down

0 comments on commit cc927df

Please sign in to comment.