github TanStack/db @tanstack/svelte-db@0.1.60

latest releases: @tanstack/angular-db@0.1.44, @tanstack/rxdb-db-collection@0.1.50, @tanstack/svelte-db@0.1.61...
3 days ago

Patch Changes

  • Add findOne() / SingleResult support to useLiveQuery hook. (#1001)

    When using .findOne() in a query, the data property is now correctly typed as T | undefined instead of Array<T>, matching the React implementation.

    Example:

    const query = useLiveQuery((q) =>
      q
        .from({ users: usersCollection })
        .where(({ users }) => eq(users.id, userId))
        .findOne(),
    )
    
    // query.data is now typed as User | undefined (not User[])

    This works with all query patterns:

    • Query functions: useLiveQuery((q) => q.from(...).findOne())
    • Config objects: useLiveQuery({ query: (q) => q.from(...).findOne() })
    • Pre-created collections with SingleResult
  • Updated dependencies [f795a67, d542667, 6503c09, b1cc4a7]:

    • @tanstack/db@0.5.17

Don't miss a new db release

NewReleases is sending notifications on new releases.