Logger, theme, and minimal deps — must finish before first React paint (F5 / webview reload does not re-run Tauri init script).
()
| 200 | |
| 201 | /** Logger, theme, and minimal deps — must finish before first React paint (F5 / webview reload does not re-run Tauri init script). */ |
| 202 | async function initializeBeforeRender(): Promise<void> { |
| 203 | const phaseStartedAt = nowMs(); |
| 204 | startupTrace.markPhase('before_render_start'); |
| 205 | await traceStartupStep('before_render_step', 'init_logger', async () => { |
| 206 | await measureAsyncAndLog(log, 'Startup step completed', () => initLogger(), { |
| 207 | data: { step: 'initLogger' }, |
| 208 | }); |
| 209 | }); |
| 210 | |
| 211 | log.info('Initializing BitFun'); |
| 212 | |
| 213 | await traceStartupStep('before_render_step', 'theme_service_initialize', async () => { |
| 214 | await measureAsyncAndLog(log, 'Startup step completed', async () => { |
| 215 | const { themeService } = await import('./infrastructure/theme'); |
| 216 | await themeService.initialize(); |
| 217 | }, { |
| 218 | data: { step: 'themeService.initialize' }, |
| 219 | }); |
| 220 | }); |
| 221 | log.info('Theme system initialized'); |
| 222 | logElapsed(log, 'Startup phase completed', phaseStartedAt, { |
| 223 | data: { phase: 'initializeBeforeRender' }, |
| 224 | }); |
| 225 | startupTrace.markPhase('before_render_end', { |
| 226 | durationMs: elapsedMs(phaseStartedAt), |
| 227 | }); |
| 228 | } |
| 229 | |
| 230 | /** Rest of startup runs after the shell is interactive so first-screen latency stays reasonable. */ |
| 231 | async function initializeAfterRender(): Promise<void> { |
no test coverage detected