Allow DebounceInput as child of FormControl Component (#3660)

This commit is contained in:
Elijah Ahianyo 2024-07-11 16:07:25 -07:00 committed by GitHub
parent dc33d208b4
commit eed0edc12a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,7 @@ from __future__ import annotations
from typing import Any, Literal from typing import Any, Literal
from reflex.components.component import ComponentNamespace from reflex.components.component import ComponentNamespace
from reflex.components.core.debounce import DebounceInput
from reflex.components.el.elements.forms import Form as HTMLForm from reflex.components.el.elements.forms import Form as HTMLForm
from reflex.components.radix.themes.components.text_field import TextFieldRoot from reflex.components.radix.themes.components.text_field import TextFieldRoot
from reflex.event import EventHandler from reflex.event import EventHandler
@ -103,9 +104,9 @@ class FormControl(FormComponent):
f"FormControl can only have at most one child, got {len(children)} children" f"FormControl can only have at most one child, got {len(children)} children"
) )
for child in children: for child in children:
if not isinstance(child, TextFieldRoot): if not isinstance(child, (TextFieldRoot, DebounceInput)):
raise TypeError( raise TypeError(
"Only Radix TextFieldRoot is allowed as child of FormControl" "Only Radix TextFieldRoot and DebounceInput are allowed as children of FormControl"
) )
return super().create(*children, **props) return super().create(*children, **props)