Skip to content

Commit a54f035

Browse files
committed
cleanup in transform_value_prop_on_input_element
1 parent 8c9990f commit a54f035

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/reactpy_django/forms/transforms.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,8 @@ def set_value_prop_on_select_element(vdom_tree: VdomDict) -> VdomDict:
4848

4949
def transform_value_prop_on_input_element(vdom_tree: VdomDict) -> VdomDict:
5050
"""Adds an onChange handler on form <input> elements, since ReactJS doesn't like uncontrolled inputs."""
51-
# vdom_tree.setdefault("eventHandlers", {})
52-
# vdom_tree.setdefault("attributes", {})
53-
# if vdom_tree["tagName"] == "input" and "onChange" not in vdom_tree["eventHandlers"]:
54-
# vdom_tree["eventHandlers"]["onChange"] = EventHandler(to_event_handler_function(_do_nothing_event))
55-
# vdom_tree["attributes"].setdefault("value", "")
56-
57-
vdom_tree.setdefault("attributes", {})
5851
if vdom_tree["tagName"] == "input":
52+
vdom_tree.setdefault("attributes", {})
5953
vdom_tree["attributes"].setdefault("defaultValue", vdom_tree["attributes"].pop("value", ""))
6054

6155
return vdom_tree

0 commit comments

Comments
 (0)