github TanStack/db @tanstack/db@0.4.10

latest releases: @tanstack/query-db-collection@0.2.31, @tanstack/db-ivm@0.1.11, @tanstack/rxdb-db-collection@0.1.21...
17 hours ago

Patch Changes

  • Add utils.setWindow() method to live query collections to dynamically change limit and offset on ordered queries. (#663)

    You can now change the pagination window of an ordered live query without recreating the collection:

    const users = createLiveQueryCollection((q) =>
      q
        .from({ user: usersCollection })
        .orderBy(({ user }) => user.name, "asc")
        .limit(10)
        .offset(0)
    )
    
    users.utils.setWindow({ offset: 10, limit: 10 })
  • Added comprehensive loading state tracking and configurable sync modes to collections and live queries: (#669)

    • Added isLoadingSubset property and loadingSubset:change events to all collections for tracking when data is being loaded
    • Added syncMode configuration option to collections:
      • 'eager' (default): Loads all data immediately during initial sync
      • 'on-demand': Only loads data as requested via loadSubset calls
    • Added comprehensive status tracking to collection subscriptions with status property ('ready' | 'loadingSubset') and events (status:change, status:ready, status:loadingSubset, unsubscribed)
    • Live queries automatically reflect loading state from their source collection subscriptions, with each query maintaining isolated loading state to prevent status "bleed" between independent queries
    • Enhanced setWindow utility to return Promise<void> when loading is triggered, allowing callers to await data loading completion
    • Added subscription parameter to loadSubset handler for advanced sync implementations that need to track subscription lifecycle
  • Updated dependencies [63aa8ef]:

    • @tanstack/db-ivm@0.1.11

Don't miss a new db release

NewReleases is sending notifications on new releases.