This commit is contained in:
Khaleel Al-Adhami 2024-11-07 14:57:38 -08:00
parent 99a2a4b003
commit 8cef32ca98
2 changed files with 12 additions and 7 deletions

View File

@ -2,7 +2,7 @@
from __future__ import annotations 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.component import Component
from reflex.components.datadisplay.logo import svg_logo from reflex.components.datadisplay.logo import svg_logo
@ -41,7 +41,7 @@ class ErrorBoundary(Component):
on_error: EventHandler[on_error_spec] on_error: EventHandler[on_error_spec]
# Rendered instead of the children when an error is caught. # Rendered instead of the children when an error is caught.
fallback_render: Var[Callable[[Any], Component]] fallback_render: Var[Component]
@classmethod @classmethod
def create(cls, *children, **props): def create(cls, *children, **props):
@ -141,7 +141,13 @@ class ErrorBoundary(Component):
justify_content="center", 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) return super().create(*children, **props)

View File

@ -3,7 +3,7 @@
# ------------------- DO NOT EDIT ---------------------- # ------------------- DO NOT EDIT ----------------------
# This file was generated by `reflex/utils/pyi_generator.py`! # 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.components.component import Component
from reflex.event import BASE_STATE, EventType from reflex.event import BASE_STATE, EventType
@ -15,13 +15,12 @@ def on_error_spec(
) -> Tuple[Var[str], Var[str]]: ... ) -> Tuple[Var[str], Var[str]]: ...
class ErrorBoundary(Component): class ErrorBoundary(Component):
def add_custom_code(self) -> List[str]: ...
@overload @overload
@classmethod @classmethod
def create( # type: ignore def create( # type: ignore
cls, cls,
*children, *children,
Fallback_component: Optional[Union[Component, Var[Component]]] = None, fallback_render: Optional[Union[Component, Var[Component]]] = None,
style: Optional[Style] = None, style: Optional[Style] = None,
key: Optional[Any] = None, key: Optional[Any] = None,
id: Optional[Any] = None, id: Optional[Any] = None,
@ -57,7 +56,7 @@ class ErrorBoundary(Component):
Args: Args:
*children: The children of the component. *children: The children of the component.
on_error: Fired when the boundary catches an error. 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. style: The style of the component.
key: A unique key for the component. key: A unique key for the component.
id: The id for the component. id: The id for the component.