feat: implement local caching for vCon data

Persist clients, storage stats, and file lists in local cache to improve initial load performance. Added breadcrumb navigation to the AdminPageHeader.
This commit is contained in:
Team Dark Devil committed 2026-11-16 23:10:44 +06:00
1 parent b42029f67d
commit 1a1c19d7bb
25 files changed
+892 -342

No files matched your search

+5 -4
View File
@@ -15,12 +15,13 @@ import {
TableWrap,
} from '@/components/ui/Table';
import { useToast } from '@/components/ui/Toast';
import { getCached, setCached } from '@/lib/vconCache';
import { useCallback, useEffect, useState } from 'react';
export default function StoragePage() {
const { success, error } = useToast();
const [stats, setStats] = useState<any>(null);
const [files, setFiles] = useState<any[]>([]);
const [stats, setStats] = useState<any>(() => getCached<any>('vcon:storage-stats', null));
const [files, setFiles] = useState<any[]>(() => getCached<any[]>('vcon:storage-files', []));
const [flushing, setFlushing] = useState(false);
const fetchStorageData = useCallback(async () => {
@@ -28,8 +29,8 @@ export default function StoragePage() {
const res = await fetch('/api/storage');
if (!res.ok) throw new Error('Unable to load storage partitions');
const data = await res.json();
setStats(data.stats);
setFiles(data.files || []);
setStats(setCached('vcon:storage-stats', data.stats));
setFiles(setCached('vcon:storage-files', data.files || []));
} catch {
error('Storage load failed', 'Could not load storage partitions.');
}