feat(FN-4924): complete Step 1 — add tasks TTL constant

Fusion-Task-Id: FN-4924
Fusion-Task-Lineage: a5f882e1-8348-4f9d-89be-15994adc148c
This commit is contained in:
Fusion (runfusion.ai)
2026-05-17 12:30:27 -07:00
committed by gsxdsm
parent f3f4a0b46b
commit 13bcb8ed85
2 changed files with 8 additions and 0 deletions

View File

@@ -1,6 +1,9 @@
/**
* Lightweight stale-while-revalidate cache helpers for dashboard reload hydration.
*
* Board task hydration uses a dedicated soft bound (`SWR_TASKS_MAX_AGE_MS`) so reloads do not present obviously stale task snapshots.
* Failed task revalidation clears the per-project tasks envelope to avoid re-hydrating stale data on the next reload.
*
* Invalidation contract:
* - Per-project task entries use `SWR_CACHE_KEYS.TASKS_PREFIX + projectId`.
* - Version updates clear TASKS_PREFIX plus PROJECTS and CURRENT_PROJECT_ID.
@@ -35,7 +38,10 @@ interface CacheEnvelope<T> {
data: T;
}
// Shared default for non-live dashboard hydration paths.
export const SWR_DEFAULT_MAX_AGE_MS = 10 * 60 * 1000;
// Board hydration soft bound: keep stale tasks visible briefly while forcing immediate revalidation.
export const SWR_TASKS_MAX_AGE_MS = 60_000;
export const SWR_LONG_MAX_AGE_MS = 24 * 60 * 60 * 1000;
function getLocalStorage(): Storage | null {