feat: add Vite configuration with custom plugins and server settings

This commit is contained in:
2026-02-21 16:16:15 +11:00
parent 576e6d77c1
commit 6c741577ce
32 changed files with 1937 additions and 20 deletions
+31
View File
@@ -0,0 +1,31 @@
// Simple in-memory cache for avatar URLs that have been successfully loaded
// This prevents the flicker when avatars re-render
const loadedAvatars = new Set<string>();
export function isAvatarCached(url: string | undefined): boolean {
if (!url) return false;
return loadedAvatars.has(url);
}
export function cacheAvatar(url: string | undefined): void {
if (url) {
loadedAvatars.add(url);
}
}
// Optional: limit cache size to prevent memory issues
const MAX_CACHE_SIZE = 1000;
export function pruneAvatarCache(): void {
if (loadedAvatars.size > MAX_CACHE_SIZE) {
const iterator = loadedAvatars.values();
// Remove oldest entries (first added)
for (let i = 0; i < loadedAvatars.size - MAX_CACHE_SIZE; i++) {
const result = iterator.next();
if (!result.done) {
loadedAvatars.delete(result.value);
}
}
}
}