-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
using ErrorBoundary to catch frontend errors work in progress
- Loading branch information
Showing
7 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""A React Error Boundary component that catches unhandled frontend exceptions.""" | ||
from reflex.components.component import Component | ||
|
||
# from reflex.constants import Hooks | ||
# import reflex as rx | ||
|
||
|
||
class ErrorBoundary(Component): | ||
"""A React Error Boundary component that catches unhandled frontend exceptions.""" | ||
|
||
library = "react-error-boundary" | ||
tag = "ErrorBoundary" | ||
|
||
# fallback: rx.Var[Component] = rx.button("Reload Page", on_click=lambda: rx.event.call_script("window.location.reload()")) | ||
|
||
# on_error: rx.EventHandler[lambda error, info: [info]] = rx.EventHandler(fn=lambda error, info: [info], state_full_name="state") | ||
|
||
# def _get_events_hooks(self) -> dict[str, None]: | ||
# """Get the hooks required by events referenced in this component. | ||
|
||
# Returns: | ||
# The hooks for the events. | ||
# """ | ||
# return {Hooks.EVENTS: None} | ||
|
||
|
||
error_boundary = ErrorBoundary.create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters