diff --git a/reflex/components/base/error_boundary.py b/reflex/components/base/error_boundary.py index 14f99222d..f328773c2 100644 --- a/reflex/components/base/error_boundary.py +++ b/reflex/components/base/error_boundary.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Callable, Dict, Tuple +from typing import Dict, Tuple from reflex.components.component import Component from reflex.components.datadisplay.logo import svg_logo @@ -41,7 +41,7 @@ class ErrorBoundary(Component): on_error: EventHandler[on_error_spec] # Rendered instead of the children when an error is caught. - fallback_render: Var[Callable[[Any], Component]] + fallback_render: Var[Component] @classmethod def create(cls, *children, **props): @@ -141,7 +141,13 @@ class ErrorBoundary(Component): justify_content="center", ) ), - _var_type=Callable[[Any], Component], + _var_type=Component, + ) + else: + props["fallback_render"] = ArgsFunctionOperation.create( + ("event_args",), + props["fallback_render"], + _var_type=Component, ) return super().create(*children, **props) diff --git a/reflex/components/base/error_boundary.pyi b/reflex/components/base/error_boundary.pyi index 92221c97d..2e9c600af 100644 --- a/reflex/components/base/error_boundary.pyi +++ b/reflex/components/base/error_boundary.pyi @@ -3,7 +3,7 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Dict, List, Optional, Tuple, Union, overload +from typing import Any, Dict, Optional, Tuple, Union, overload from reflex.components.component import Component from reflex.event import BASE_STATE, EventType @@ -15,13 +15,12 @@ def on_error_spec( ) -> Tuple[Var[str], Var[str]]: ... class ErrorBoundary(Component): - def add_custom_code(self) -> List[str]: ... @overload @classmethod def create( # type: ignore cls, *children, - Fallback_component: Optional[Union[Component, Var[Component]]] = None, + fallback_render: Optional[Union[Component, Var[Component]]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, @@ -57,7 +56,7 @@ class ErrorBoundary(Component): Args: *children: The children of the component. on_error: Fired when the boundary catches an error. - Fallback_component: Rendered instead of the children when an error is caught. + fallback_render: Rendered instead of the children when an error is caught. style: The style of the component. key: A unique key for the component. id: The id for the component.