mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-30 15:01:53 +00:00
fix(desktop): preserve lazy Sentry loading (#45776)
This commit is contained in:
parent
62d9aa9838
commit
84fa689686
1 changed files with 10 additions and 4 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { TextField } from "@opencode-ai/ui/text-field"
|
||||
import { captureException, isEnabled } from "@sentry/solid"
|
||||
import type { captureException } from "@sentry/solid"
|
||||
import { Logo } from "@opencode-ai/ui/logo"
|
||||
import { Button } from "@opencode-ai/ui/button"
|
||||
import { Component, createSignal, onMount, Show } from "solid-js"
|
||||
|
|
@ -227,6 +227,7 @@ export const ErrorPage: Component<ErrorPageProps> = (props) => {
|
|||
let recordedFatalError: Promise<void> | undefined
|
||||
const [store, setStore] = createStore({
|
||||
actionError: undefined as string | undefined,
|
||||
captureException: undefined as typeof captureException | undefined,
|
||||
})
|
||||
|
||||
function ensureFatalErrorRecorded() {
|
||||
|
|
@ -243,6 +244,11 @@ export const ErrorPage: Component<ErrorPageProps> = (props) => {
|
|||
|
||||
onMount(() => {
|
||||
void ensureFatalErrorRecorded().catch(() => undefined)
|
||||
void import("@sentry/solid")
|
||||
.then(({ captureException, isEnabled }) => {
|
||||
if (isEnabled()) setStore("captureException", () => captureException)
|
||||
})
|
||||
.catch(() => undefined)
|
||||
})
|
||||
|
||||
async function checkForUpdates() {
|
||||
|
|
@ -311,15 +317,15 @@ export const ErrorPage: Component<ErrorPageProps> = (props) => {
|
|||
{language.t("error.page.action.exportLogs")}
|
||||
</Button>
|
||||
</Show>
|
||||
<Show when={isEnabled}>
|
||||
{(_) => {
|
||||
<Show when={store.captureException}>
|
||||
{(capture) => {
|
||||
const [reported, setReported] = createSignal(false)
|
||||
return (
|
||||
<Button
|
||||
size="large"
|
||||
disabled={reported()}
|
||||
onClick={() => {
|
||||
captureException(props.error)
|
||||
capture()(props.error)
|
||||
setReported(true)
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue