feat: entity cache system, nav UX improvements, split CLAUDE.md
- Add $state-based entity cache layer with 30s TTL, request deduplication, and local mutation helpers (entity-cache.svelte.ts + caches.svelte.ts) - Wire all 10 page components to use shared caches for cross-page data - Add slide animation for nav tree expand/collapse with rotating chevron - Remove aggregate count badges from container nav nodes (keep on leaves) - Convert Targets from flat leaf to group with per-type children (Telegram, Webhook, Email, Discord, Slack, ntfy, Matrix) - Add URL-based type filtering on Targets page with per-type descriptions - Add Bots group children for Email and Matrix alongside Telegram - Tab-based routing for bots page (?tab=telegram/email/matrix) - Add per-type target counts and email/matrix bot counts to /status/counts - Split CLAUDE.md into focused context files under .claude/docs/ - Fix .gitignore: scope lib/ to root, allow .claude/docs/ tracking - Clear all caches on logout - Reset form state when switching target type tabs
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Singleton entity caches for all shared entities.
|
||||
*
|
||||
* Import from here in page components:
|
||||
* import { providersCache, targetsCache } from '$lib/stores/caches.svelte';
|
||||
*/
|
||||
|
||||
import { createEntityCache } from './entity-cache.svelte';
|
||||
import type {
|
||||
ServiceProvider,
|
||||
NotificationTarget,
|
||||
TrackingConfig,
|
||||
TemplateConfig,
|
||||
TelegramBot,
|
||||
EmailBot,
|
||||
MatrixBot,
|
||||
} from '$lib/types';
|
||||
|
||||
/** Service providers — used by Dashboard, Trackers, Command Trackers, Providers page. */
|
||||
export const providersCache = createEntityCache<ServiceProvider>('/providers');
|
||||
|
||||
/** Notification targets — used by Trackers, Targets page. */
|
||||
export const targetsCache = createEntityCache<NotificationTarget>('/targets');
|
||||
|
||||
/** Tracking configs — used by Trackers, Tracking Configs page. */
|
||||
export const trackingConfigsCache = createEntityCache<TrackingConfig>('/tracking-configs');
|
||||
|
||||
/** Template configs — used by Trackers, Template Configs page. */
|
||||
export const templateConfigsCache = createEntityCache<TemplateConfig>('/template-configs');
|
||||
|
||||
/** Telegram bots — used by Targets, Command Trackers, Bots page. */
|
||||
export const telegramBotsCache = createEntityCache<TelegramBot>('/telegram-bots');
|
||||
|
||||
/** Email bots — used by Targets, Bots page. */
|
||||
export const emailBotsCache = createEntityCache<EmailBot>('/email-bots');
|
||||
|
||||
/** Matrix bots — used by Targets, Bots page. */
|
||||
export const matrixBotsCache = createEntityCache<MatrixBot>('/matrix-bots');
|
||||
|
||||
// Command-specific caches (less shared but still benefit from caching)
|
||||
|
||||
export const commandConfigsCache = createEntityCache<any>('/command-configs');
|
||||
|
||||
export const commandTemplateConfigsCache = createEntityCache<any>('/command-template-configs');
|
||||
|
||||
/**
|
||||
* Invalidate all entity caches. Useful on logout.
|
||||
*/
|
||||
export function clearAllCaches(): void {
|
||||
providersCache.clear();
|
||||
targetsCache.clear();
|
||||
trackingConfigsCache.clear();
|
||||
templateConfigsCache.clear();
|
||||
telegramBotsCache.clear();
|
||||
emailBotsCache.clear();
|
||||
matrixBotsCache.clear();
|
||||
commandConfigsCache.clear();
|
||||
commandTemplateConfigsCache.clear();
|
||||
}
|
||||
Reference in New Issue
Block a user