Improve caching
This commit is contained in:
@@ -50,7 +50,7 @@ The runtime is intended to scale in four different ways: number of routes, sessi
|
||||
|
||||
### Route and DOM scale
|
||||
|
||||
Only the active route, recent inactive routes, and a transaction preview need mounted component trees. `maxInactive` bounds the inactive mounted cache; the default is eight. Older views are marked evicted and lazily remounted when needed.
|
||||
Only the active route, previously visited inactive routes, and a transaction preview need mounted component trees. Siblings are not instantiated eagerly at application startup. `maxInactive` bounds the inactive mounted cache; the default is four. Pinned entries are deliberately outside this ordinary budget. Older views are marked evicted and lazily remounted when needed.
|
||||
|
||||
During an interaction, animation work concerns two surfaces regardless of total route count:
|
||||
|
||||
@@ -68,6 +68,8 @@ The current implementation uses linear searches through view entries for some re
|
||||
|
||||
The view cache is not an application data cache. Large collections, message history, drafts, and durable form state should live outside route component instances. This allows view eviction to remain cheap and makes state available whether a route is reached through a gesture, deep link, background notification, or restored session.
|
||||
|
||||
Cached components should also avoid doing active-screen work indefinitely. Route-aware lifecycle effects let polling, animation loops, media, and subscriptions stop while a component is inactive and resume without losing its local render state. Hosts can call `trimCache()` under memory pressure; the Capacitor adapter does so when the app pauses by default.
|
||||
|
||||
Preview loading should fetch only what the destination needs to render its initial surface. Applications can use route-level lazy imports, shared stores, request deduplication, and cancellation to avoid duplicating expensive work during a cancelled preview.
|
||||
|
||||
### Team and feature scale
|
||||
|
||||
Reference in New Issue
Block a user