Skip to content

Commit dc85d17

Browse files
committed
body_content -> prepend_body
1 parent 24d08e9 commit dc85d17

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

src/reactpy/executors/asgi/pyscript.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,10 @@ class ReactPyPyscriptApp(ReactPyApp):
106106
def render_index_html(self) -> None:
107107
"""Process the index.html and store the results in this class."""
108108
head_content = vdom_head_to_html(self.parent.html_head)
109-
body_content = (
110-
""
111-
if self.parent.prepend_body is None
112-
else reactpy_to_string(self.parent.prepend_body)
113-
)
109+
if not self.parent.prepend_body or self.parent.prepend_body == ...:
110+
prepend_body = ""
111+
else:
112+
prepend_body = reactpy_to_string(self.parent.prepend_body)
114113
pyscript_setup = pyscript_setup_html(
115114
extra_py=self.parent.extra_py,
116115
extra_js=self.parent.extra_js,
@@ -128,7 +127,7 @@ def render_index_html(self) -> None:
128127
f'<html lang="{self.parent.html_lang}">'
129128
f"{head_content}"
130129
"<body>"
131-
f"{body_content}"
130+
f"{prepend_body}"
132131
f"{pyscript_component}"
133132
"</body>"
134133
"</html>"

src/reactpy/executors/asgi/standalone.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,17 +240,16 @@ async def __call__(
240240

241241
def render_index_html(self) -> None:
242242
"""Process the index.html and store the results in this class."""
243-
body_content = (
244-
""
245-
if self.parent.prepend_body is None
246-
else reactpy_to_string(self.parent.prepend_body)
247-
)
243+
if not self.parent.prepend_body or self.parent.prepend_body == ...:
244+
prepend_body = ""
245+
else:
246+
prepend_body = reactpy_to_string(self.parent.prepend_body)
248247
self._index_html = (
249248
"<!doctype html>"
250249
f'<html lang="{self.parent.html_lang}">'
251250
f"{vdom_head_to_html(self.parent.html_head)}"
252251
"<body>"
253-
f"{body_content}"
252+
f"{prepend_body}"
254253
f"{server_side_component_html(element_id='app', class_='', component_path='')}"
255254
"</body>"
256255
"</html>"

0 commit comments

Comments
 (0)