Eliminates white flash by deferring window show until paint
Defers Electron window display until the renderer signals first meaningful paint, avoiding initial blank screens or white flashes, especially on startup and settings windows. Implements a handshake using a renderer-to-main process message, color-matches background to the current theme, and falls back to a timeout in development. Also migrates font loading to npm packages, replaces Google Fonts usage, and adds code-splitting for dialogs and quick switcher to improve performance. Restricts console debug output to development.
This commit is contained in:
16
index.tsx
16
index.tsx
@@ -1,9 +1,17 @@
|
||||
import { Suspense, lazy } from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import '@xterm/xterm/css/xterm.css';
|
||||
import '@fontsource/space-grotesk/400.css';
|
||||
import '@fontsource/space-grotesk/500.css';
|
||||
import '@fontsource/space-grotesk/600.css';
|
||||
import '@fontsource/space-grotesk/700.css';
|
||||
import '@fontsource/jetbrains-mono/400.css';
|
||||
import '@fontsource/jetbrains-mono/500.css';
|
||||
import '@fontsource/jetbrains-mono/600.css';
|
||||
import App from './App';
|
||||
import SettingsPage from './components/SettingsPage';
|
||||
import { ToastProvider } from './components/ui/toast';
|
||||
|
||||
const LazySettingsPage = lazy(() => import('./components/SettingsPage'));
|
||||
|
||||
const rootElement = document.getElementById('root');
|
||||
if (!rootElement) {
|
||||
throw new Error("Could not find root element to mount to");
|
||||
@@ -25,7 +33,9 @@ const renderApp = () => {
|
||||
if (route === 'settings') {
|
||||
root.render(
|
||||
<ToastProvider>
|
||||
<SettingsPage />
|
||||
<Suspense fallback={null}>
|
||||
<LazySettingsPage />
|
||||
</Suspense>
|
||||
</ToastProvider>
|
||||
);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user