Files
goodbuddy/src/renderer/src/main.tsx
T
mesalogo b755951ecd fix: offer recovery for blank desktop windows
React render failures now show a localized reload page, and renderer crashes offer native reload confirmation. Record renderer and load failures in existing diagnostics without automatic retry loops. Reload may lose unsaved input; the intermittent failure cause remains unconfirmed.

Release note: Recover from desktop rendering failures using a visible Reload action instead of being left without a recovery entry point.
2026-09-15 08:07:08 +08:00

66 lines
1.6 KiB
TypeScript

import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import '@fontsource-variable/noto-sans-sc/wght.css'
import 'katex/dist/katex.min.css'
import './markdown-math.css'
import App from './App'
import { AppErrorBoundary } from './AppErrorBoundary'
import { StorageUpgrade } from './StorageUpgrade'
import { installBundledUiFonts } from './fonts'
import { changeUiLocale } from './i18n'
import {
UiLocaleProvider
} from './i18n/UiLocaleProvider'
import {
loadUiLocalePreference,
resolveUiLocale,
systemUiLanguages
} from './i18n/locale'
import {
applyAppearanceTheme,
loadAppearanceTheme,
resolveAppearanceTheme
} from './theme'
import { installDocumentOcrBridge } from './document-ocr-bridge'
import './styles.css'
const root = document.getElementById('root')
if (!root) {
throw new Error('Root element not found')
}
installBundledUiFonts()
const initialUiLocalePreference = loadUiLocalePreference()
void changeUiLocale(
resolveUiLocale(
initialUiLocalePreference,
systemUiLanguages()
)
)
applyAppearanceTheme(
resolveAppearanceTheme(
loadAppearanceTheme(),
typeof window.matchMedia === 'function' &&
window.matchMedia('(prefers-color-scheme: dark)').matches
)
)
installDocumentOcrBridge()
createRoot(root).render(
<StrictMode>
<AppErrorBoundary>
<UiLocaleProvider
initialPreference={initialUiLocalePreference}
>
{new URLSearchParams(window.location.search).get('storageUpgrade') === '1'
? <StorageUpgrade />
: <App />}
</UiLocaleProvider>
</AppErrorBoundary>
</StrictMode>
)