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

+9
View File
@@ -56,6 +56,15 @@ export async function hasPermission(permission: string): Promise<boolean> {
return matchesPermission(permissions, isAdmin, permission);
}
/**
* Warms the permissions cache before the shell mounts, so permission-gated
* rail items are already known on first paint instead of popping in once
* usePermissions' own fetch resolves.
*/
export function preloadPermissions(): Promise<void> {
return load().then(() => undefined);
}
export function notifyPermissionsChanged(): void {
cache = null;
window.dispatchEvent(new Event(PERMISSIONS_CHANGED_EVENT));