Patch Changes
-
feat: implement Collection Lifecycle Management (#198)
Adds automatic lifecycle management for collections to optimize resource usage.
New Features:
- Added
startSync
option (defaults tofalse
, set totrue
to start syncing immediately) - Automatic garbage collection after
gcTime
(default 5 minutes) of inactivity - Collection status tracking: "idle" | "loading" | "ready" | "error" | "cleaned-up"
- Manual
preload()
andcleanup()
methods for lifecycle control
Usage:
const collection = createCollection({ startSync: false, // Enable lazy loading gcTime: 300000, // Cleanup timeout (default: 5 minutes) }) console.log(collection.status) // Current state await collection.preload() // Ensure ready await collection.cleanup() // Manual cleanup
- Added
-
Updated dependencies [
945868e
,0f8a008
,57b5f5d
]:- @tanstack/db@0.0.13