You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After bab0b45 [🔥] Remove in-app language settings, the useSyncExternalStore-based subscription system in src/i18n/ is dead code, and the locale key written to app_preferences by previous builds is now an orphan row for any user who upgrades from a build that shipped the picker.
Problem
Dead subscription plumbing
// src/i18n/index.ts:20-36constlisteners=newSet<()=>void>();constversion=0;exportfunctiongetCurrentLocale(): SupportedLocale{returncurrentLocale;}exportfunctiongetLocaleVersion(): number{returnversion;}// never incrementsexportfunctionsubscribeToLocale(listener: ()=>void): ()=>void{listeners.add(listener);return()=>{listeners.delete(listener);};}
version is a const that never changes; nothing ever calls each listener (listeners is added-to but never iterated). The hook still wires through useSyncExternalStore:
This compiles and runs fine, but it advertises a re-render pathway that does not exist. Future readers will think the locale can change at runtime.
Stale preference key
bab0b45 removed all writers and readers for the locale key, but the row may still exist in the user's SQLite for anyone who upgraded from a version that shipped the picker. There is no migration to drop it. Effects:
Harmless functionally, but getAllPreferences() returns it during export, mismatching the documented set of keys.
app_preferences debug snapshots will look puzzling to future maintainers.
Relevant files
src/i18n/index.ts:20-36 — dead store plumbing
src/i18n/useTranslation.ts:24-37 — pulls through unused subscription
src/database/repositories/appPreferenceRepository.ts:11-13 — surfaces the orphan row in getAllPreferences
src/services/exportService.ts:90-91 — bundles app_preferences into backups, so the orphan key gets re-imported on hypothetical future restore
Proposed fix
In src/i18n/index.ts, drop listeners, version, getLocaleVersion, subscribeToLocale. Keep t, getCurrentLocale.
In src/i18n/useTranslation.ts, replace the useSyncExternalStore with a plain useMemo (or just inline t). Same return shape { t, locale }.
Add a one-shot startup cleanup (or a Drizzle data migration) that deletes app_preferences rows where key = 'locale'. Cheap to implement next to seedTechniqueOptions.
Acceptance criteria
useTranslation still works at every call site without behavior change.
grep -r subscribeToLocale src/ returns no matches.
Existing users with an upgraded DB no longer see a dangling locale row in app_preferences.
Summary
After
bab0b45 [🔥] Remove in-app language settings, theuseSyncExternalStore-based subscription system insrc/i18n/is dead code, and thelocalekey written toapp_preferencesby previous builds is now an orphan row for any user who upgrades from a build that shipped the picker.Problem
Dead subscription plumbing
versionis aconstthat never changes; nothing ever calls each listener (listenersis added-to but never iterated). The hook still wires throughuseSyncExternalStore:This compiles and runs fine, but it advertises a re-render pathway that does not exist. Future readers will think the locale can change at runtime.
Stale preference key
bab0b45removed all writers and readers for thelocalekey, but the row may still exist in the user's SQLite for anyone who upgraded from a version that shipped the picker. There is no migration to drop it. Effects:getAllPreferences()returns it during export, mismatching the documented set of keys.app_preferencesdebug snapshots will look puzzling to future maintainers.Relevant files
src/i18n/index.ts:20-36— dead store plumbingsrc/i18n/useTranslation.ts:24-37— pulls through unused subscriptionsrc/database/repositories/appPreferenceRepository.ts:11-13— surfaces the orphan row ingetAllPreferencessrc/services/exportService.ts:90-91— bundlesapp_preferencesinto backups, so the orphan key gets re-imported on hypothetical future restoreProposed fix
src/i18n/index.ts, droplisteners,version,getLocaleVersion,subscribeToLocale. Keept,getCurrentLocale.src/i18n/useTranslation.ts, replace theuseSyncExternalStorewith a plainuseMemo(or just inlinet). Same return shape{ t, locale }.app_preferencesrows wherekey = 'locale'. Cheap to implement next toseedTechniqueOptions.Acceptance criteria
useTranslationstill works at every call site without behavior change.grep -r subscribeToLocale src/returns no matches.localerow inapp_preferences.Related