-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: no sentry captures for scans and tx decoding (#1736)
* fix: throttle reads on asset discovery store * fix: remove useless shareReplay * fix: remove "failed to scan" sentry capture * fix: dont use sentry's error boundary for tx decoding
- Loading branch information
Showing
7 changed files
with
60 additions
and
18 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
apps/extension/src/@talisman/components/FallbackErrorBoundary.tsx
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,43 @@ | ||
import { log } from "extension-shared" | ||
import { Component, ErrorInfo, ReactNode } from "react" | ||
|
||
interface FallbackErrorBoundaryProps { | ||
children: ReactNode | ||
fallback: ReactNode | ||
} | ||
|
||
interface FallbackErrorBoundaryState { | ||
hasError: boolean | ||
} | ||
|
||
/** | ||
* Error boundary that catches errors in its children and renders a fallback UI. | ||
* Use this if you don't want to use the Sentry error boundary. | ||
*/ | ||
export class FallbackErrorBoundary extends Component< | ||
FallbackErrorBoundaryProps, | ||
FallbackErrorBoundaryState | ||
> { | ||
constructor(props: FallbackErrorBoundaryProps) { | ||
super(props) | ||
this.state = { hasError: false } | ||
} | ||
|
||
static getDerivedStateFromError(_: Error): FallbackErrorBoundaryState { | ||
// Update state so the next render will show the fallback UI. | ||
return { hasError: true } | ||
} | ||
|
||
componentDidCatch(error: Error, info: ErrorInfo): void { | ||
log.warn("FallbackErrorBoundary caught an error", { error, info }) | ||
} | ||
|
||
render() { | ||
if (this.state.hasError) { | ||
// Render the provided fallback UI | ||
return this.props.fallback | ||
} | ||
|
||
return this.props.children | ||
} | ||
} |
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
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