feat: improve UI loading time and jitter

This commit is contained in:
LukeGus committed 2026-09-25 11:33:24 -05:00
1 parent 0f8956dcf3
commit 4a320a2258
8 files changed
+279 -137

No files matched your search

+12 -2
View File
@@ -169,9 +169,19 @@ export function parseCustomKeybindings(
}
}
const userPreferencesCache = createTtlRequestCache<UserPreferences>(10_000);
/**
* Cached briefly so the loading gate's prefetch and the shell's own read on
* mount share one request instead of two, which is what let stale
* localStorage flags (hiddenRailTabs, pinAppRail) flash before the real
* values landed a moment after the shell first rendered.
*/
export async function getUserPreferences(): Promise<UserPreferences> {
const response = await authApi.get("/user-preferences");
return response.data;
return userPreferencesCache.get(async () => {
const response = await authApi.get("/user-preferences");
return response.data;
});
}
export async function saveUserPreferences(