perf: bound SWR cache, clean stale storage, cap annotations
Add LRU cache provider (200 entries) to prevent unbounded SWR memory growth. Clean up stale PKCE localStorage keys on app init. Cap chart annotations to 20 visible reference lines with overflow indicator.
This commit is contained in:
@@ -7,6 +7,7 @@ import { LoadingOverlay, useSessionSync, SessionExpiryWarning } from '@ciphera-n
|
||||
import { logoutAction, getSessionAction, setSessionAction } from '@/app/actions/auth'
|
||||
import { getUserOrganizations, switchContext } from '@/lib/api/organization'
|
||||
import { logger } from '@/lib/utils/logger'
|
||||
import { cleanupStaleStorage } from '@/lib/utils/storage-cleanup'
|
||||
|
||||
interface User {
|
||||
id: string
|
||||
@@ -131,6 +132,8 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
// Initial load
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
cleanupStaleStorage()
|
||||
|
||||
// * 1. Check server-side session (cookies)
|
||||
let session: Awaited<ReturnType<typeof getSessionAction>> = null
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user