@@ -129,7 +129,7 @@ def is_vdom(value: Any) -> bool:
129
129
def vdom (
130
130
tag : str ,
131
131
* attributes_and_children : VdomAttributesAndChildren ,
132
- key : str = "" ,
132
+ key : str | int | None = None ,
133
133
event_handlers : Optional [EventHandlerMapping ] = None ,
134
134
import_source : Optional [ImportSourceDict ] = None ,
135
135
) -> VdomDict :
@@ -169,7 +169,7 @@ def vdom(
169
169
if event_handlers :
170
170
model ["eventHandlers" ] = event_handlers
171
171
172
- if key != "" :
172
+ if key is not None :
173
173
model ["key" ] = key
174
174
175
175
if import_source is not None :
@@ -182,7 +182,7 @@ class _VdomDictConstructor(Protocol):
182
182
def __call__ (
183
183
self ,
184
184
* attributes_and_children : VdomAttributesAndChildren ,
185
- key : str = ...,
185
+ key : str | int | None = ...,
186
186
event_handlers : Optional [EventHandlerMapping ] = ...,
187
187
import_source : Optional [ImportSourceDict ] = ...,
188
188
) -> VdomDict :
@@ -200,7 +200,7 @@ def make_vdom_constructor(
200
200
201
201
def constructor (
202
202
* attributes_and_children : VdomAttributesAndChildren ,
203
- key : str = "" ,
203
+ key : str | int | None = None ,
204
204
event_handlers : Optional [EventHandlerMapping ] = None ,
205
205
import_source : Optional [ImportSourceDict ] = None ,
206
206
) -> VdomDict :
@@ -333,7 +333,11 @@ def _is_single_child(value: Any) -> bool:
333
333
logger .error (f"Key not specified for child in list { child } " )
334
334
elif isinstance (child , Mapping ) and "key" not in child :
335
335
# remove 'children' to reduce log spam
336
- child_copy = {** child , "children" : ... }
336
+ child_copy = {** child , "children" : _EllipsisRepr () }
337
337
logger .error (f"Key not specified for child in list { child_copy } " )
338
338
339
339
return False
340
+
341
+ class _EllipsisRepr :
342
+ def __repr__ (self ) -> str :
343
+ return "..."
0 commit comments