Skip to content

Commit d4ccc5e

Browse files
committed
misc use_ref cleanup
1 parent b57da2b commit d4ccc5e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/reactpy_django/forms/components.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ def _django_form(
4949
):
5050
from reactpy_django import config
5151

52-
uuid_ref = hooks.use_ref(uuid4().hex.replace("-", ""))
52+
uuid = hooks.use_ref(uuid4().hex.replace("-", "")).current
5353
top_children_count = hooks.use_ref(len(top_children))
5454
bottom_children_count = hooks.use_ref(len(bottom_children))
5555
submitted_data, set_submitted_data = hooks.use_state({} or None)
5656
rendered_form, set_rendered_form = hooks.use_state(cast(Union[str, None], None))
57-
uuid = uuid_ref.current
5857

5958
# Initialize the form with the provided data
6059
validate_form_args(top_children, top_children_count, bottom_children, bottom_children_count, form)

src/reactpy_django/pyscript/components.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ def _pyscript_component(
2020
root: str = "root",
2121
):
2222
rendered, set_rendered = hooks.use_state(False)
23-
uuid_ref = hooks.use_ref(uuid4().hex.replace("-", ""))
24-
uuid = uuid_ref.current
23+
uuid = hooks.use_ref(uuid4().hex.replace("-", "")).current
2524
initial = reactpy_to_string(initial, uuid=uuid)
2625
executor = render_pyscript_template(file_paths, uuid, root)
2726

0 commit comments

Comments
 (0)