Skip to content

Commit

Permalink
cleanup in transform_value_prop_on_input_element
Browse files Browse the repository at this point in the history
  • Loading branch information
Archmonger committed Dec 7, 2024
1 parent 8c9990f commit a54f035
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/reactpy_django/forms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,8 @@ def set_value_prop_on_select_element(vdom_tree: VdomDict) -> VdomDict:

def transform_value_prop_on_input_element(vdom_tree: VdomDict) -> VdomDict:
"""Adds an onChange handler on form <input> elements, since ReactJS doesn't like uncontrolled inputs."""
# vdom_tree.setdefault("eventHandlers", {})
# vdom_tree.setdefault("attributes", {})
# if vdom_tree["tagName"] == "input" and "onChange" not in vdom_tree["eventHandlers"]:
# vdom_tree["eventHandlers"]["onChange"] = EventHandler(to_event_handler_function(_do_nothing_event))
# vdom_tree["attributes"].setdefault("value", "")

vdom_tree.setdefault("attributes", {})
if vdom_tree["tagName"] == "input":
vdom_tree.setdefault("attributes", {})
vdom_tree["attributes"].setdefault("defaultValue", vdom_tree["attributes"].pop("value", ""))

return vdom_tree
Expand Down

0 comments on commit a54f035

Please sign in to comment.