File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -74,14 +74,14 @@ def infer_key_from_attributes(vdom_tree: VdomDict) -> VdomDict:
7474 attributes = vdom_tree .get ("attributes" , {})
7575
7676 # Infer 'key' from 'id'
77- _id = attributes .get ("id" )
77+ key = attributes .get ("id" )
7878
7979 # Fallback: Infer 'key' from 'name'
80- if not _id and vdom_tree ["tagName" ] in {"input" , "select" , "textarea" }:
81- _id = attributes .get ("name" )
80+ if not key and vdom_tree ["tagName" ] in {"input" , "select" , "textarea" }:
81+ key = attributes .get ("name" )
8282
83- if _id :
84- vdom_tree ["key" ] = _id
83+ if key :
84+ vdom_tree ["key" ] = key
8585
8686 return vdom_tree
8787
@@ -479,7 +479,8 @@ def _do_nothing_event(*args, **kwargs):
479479 + SCRIPT_PROPS
480480)
481481
482- # lowercase the prop name as the key, and have values be the original react prop name
482+ # Old Prop (Key) : New Prop (Value)
483+ # Also includes some special cases like 'class' -> 'className'
483484REACT_PROP_SUBSTITUTIONS = {prop .lower (): prop for prop in KNOWN_REACT_PROPS } | {
484485 "for" : "htmlFor" ,
485486 "class" : "className" ,
Original file line number Diff line number Diff line change 1+ """Generic functions that are used throughout the ReactPy Django package."""
2+
13from __future__ import annotations
24
35import contextlib
You can’t perform that action at this time.
0 commit comments