experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(settings): call api.initialize() so datastore + theme load (Cat 6)

settings.html was migrated to tile-preload in Phase 3.11b-settings1, but
settings.js never called api.initialize(). Without it, tokenValid is
false in tile-preload — api.datastore.* calls silently return empty (caught
in createDatastoreStore at app/utils.js:83) and api.subscribe no-ops. The
settings pane renders with empty data and theme CSS is never injected, so
--theme-font-sans is absent and smoke test 1172 (Data Persistence, theme
assertion at line 1362) fails.

Add await api.initialize() at the top of init() before any other API call,
matching the pattern in app/cmd/index.html, app/hud/index.html, and
app/_test/index.html. Also wrap the top-level api.subscribe('settings:navigate', ...)
call in an async IIFE that awaits api.initialize() so the subscription
does not silently no-op when the module loads before the token is validated.

See docs/v1-removal-smoke-regressions.md section 7.

+20 -5
+20 -5
app/settings/settings.js
··· 3211 3211 3212 3212 // Initialize 3213 3213 const init = async () => { 3214 + // Initialize the tile-preload surface before any API calls. Without this, 3215 + // `tokenValid` is false and api.datastore/api.theme/api.subscribe all silently 3216 + // no-op or reject — createDatastoreStore returns empty, theme CSS is never 3217 + // injected, and --theme-font-sans is absent (see docs/v1-removal-smoke-regressions.md §7). 3218 + if (api.initialize) { 3219 + await api.initialize(); 3220 + } 3221 + 3214 3222 const sidebarNav = document.getElementById('sidebarNav'); 3215 3223 const contentArea = document.getElementById('settingsContent'); 3216 3224 ··· 3480 3488 3481 3489 // No IZUI init needed — backend handles focus restoration and ESC policy via roles. 3482 3490 3483 - // Listen for navigation requests from commands 3484 - api.subscribe('settings:navigate', (msg) => { 3485 - if (msg.section) { 3486 - showSection(msg.section); 3491 + // Listen for navigation requests from commands. Wrap in an async IIFE so 3492 + // `api.initialize()` completes before `api.subscribe` runs — otherwise the 3493 + // subscribe silently no-ops when `tokenValid=false`. 3494 + (async () => { 3495 + if (api.initialize) { 3496 + await api.initialize(); 3487 3497 } 3488 - }, api.scopes.GLOBAL); 3498 + api.subscribe('settings:navigate', (msg) => { 3499 + if (msg.section) { 3500 + showSection(msg.section); 3501 + } 3502 + }, api.scopes.GLOBAL); 3503 + })(); 3489 3504 3490 3505 // Expose showSection for external navigation 3491 3506 window.showSettingsSection = showSection;