Sfoglia il codice sorgente

Allow DebounceInput as child of FormControl Component (#3660)

Elijah Ahianyo 10 mesi fa
parent
commit
eed0edc12a
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 3 2
      reflex/components/radix/primitives/form.py

+ 3 - 2
reflex/components/radix/primitives/form.py

@@ -5,6 +5,7 @@ from __future__ import annotations
 from typing import Any, Literal
 
 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.radix.themes.components.text_field import TextFieldRoot
 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"
             )
         for child in children:
-            if not isinstance(child, TextFieldRoot):
+            if not isinstance(child, (TextFieldRoot, DebounceInput)):
                 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)