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.
66 lines
1.6 KiB
TypeScript
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>
|
|
)
|