Skip to content

Commit e7d1764

Browse files
committed
vdom_or_component_to_string -> reactpy_to_string
1 parent 1ee2799 commit e7d1764

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/reactpy_django/pyscript/components.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from reactpy_django.html import pyscript
99
from reactpy_django.pyscript.utils import render_pyscript_template
10-
from reactpy_django.utils import vdom_or_component_to_string
10+
from reactpy_django.utils import reactpy_to_string
1111

1212

1313
@component
@@ -19,7 +19,7 @@ def _pyscript_component(
1919
rendered, set_rendered = hooks.use_state(False)
2020
uuid_ref = hooks.use_ref(uuid4().hex.replace("-", ""))
2121
uuid = uuid_ref.current
22-
initial = vdom_or_component_to_string(initial, uuid=uuid)
22+
initial = reactpy_to_string(initial, uuid=uuid)
2323
executor = render_pyscript_template(file_paths, uuid, root)
2424

2525
if not rendered:

src/reactpy_django/templatetags/reactpy.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
from reactpy_django.pyscript.utils import PYSCRIPT_LAYOUT_HANDLER, extend_pyscript_config, render_pyscript_template
1919
from reactpy_django.utils import (
2020
prerender_component,
21+
reactpy_to_string,
2122
save_component_params,
2223
strtobool,
2324
validate_component_args,
2425
validate_host,
25-
vdom_or_component_to_string,
2626
)
2727

2828
if TYPE_CHECKING:
@@ -203,7 +203,7 @@ def pyscript_component(
203203

204204
uuid = uuid4().hex
205205
request: HttpRequest | None = context.get("request")
206-
initial = vdom_or_component_to_string(initial, request=request, uuid=uuid)
206+
initial = reactpy_to_string(initial, request=request, uuid=uuid)
207207
executor = render_pyscript_template(file_paths, uuid, root)
208208

209209
return {

src/reactpy_django/utils.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,7 @@ def prerender_component(
410410
return vdom_to_html(vdom_tree) # type: ignore
411411

412412

413-
def vdom_or_component_to_string(
414-
vdom_or_component: Any, request: HttpRequest | None = None, uuid: str | None = None
415-
) -> str:
413+
def reactpy_to_string(vdom_or_component: Any, request: HttpRequest | None = None, uuid: str | None = None) -> str:
416414
"""Converts a VdomDict or component to an HTML string. If a string is provided instead, it will be
417415
automatically returned."""
418416
if isinstance(vdom_or_component, dict):

0 commit comments

Comments
 (0)