File tree 2 files changed +9
-6
lines changed
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:
74
74
attributes = vdom_tree .get ("attributes" , {})
75
75
76
76
# Infer 'key' from 'id'
77
- _id = attributes .get ("id" )
77
+ key = attributes .get ("id" )
78
78
79
79
# 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" )
82
82
83
- if _id :
84
- vdom_tree ["key" ] = _id
83
+ if key :
84
+ vdom_tree ["key" ] = key
85
85
86
86
return vdom_tree
87
87
@@ -479,7 +479,8 @@ def _do_nothing_event(*args, **kwargs):
479
479
+ SCRIPT_PROPS
480
480
)
481
481
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'
483
484
REACT_PROP_SUBSTITUTIONS = {prop .lower (): prop for prop in KNOWN_REACT_PROPS } | {
484
485
"for" : "htmlFor" ,
485
486
"class" : "className" ,
Original file line number Diff line number Diff line change
1
+ """Generic functions that are used throughout the ReactPy Django package."""
2
+
1
3
from __future__ import annotations
2
4
3
5
import contextlib
You can’t perform that action at this time.
0 commit comments