github TanStack/db @tanstack/db-collections@0.0.16

latest releases: @tanstack/trailbase-db-collection@0.1.12, @tanstack/svelte-db@0.1.12, @tanstack/vue-db@0.0.45...
2 months ago

Patch Changes

  • feat: implement Collection Lifecycle Management (#198)

    Adds automatic lifecycle management for collections to optimize resource usage.

    New Features:

    • Added startSync option (defaults to false, set to true 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() and cleanup() 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
  • Updated dependencies [945868e, 0f8a008, 57b5f5d]:

    • @tanstack/db@0.0.13

Don't miss a new db release

NewReleases is sending notifications on new releases.