-
Notifications
You must be signed in to change notification settings - Fork 152
Fix type of findOne queries in Vue #1134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: cursor/vue-findone-types-reproduction-4349
Are you sure you want to change the base?
Fix type of findOne queries in Vue #1134
Conversation
Update useLiveQuery types to use InferResultType<TContext> which correctly handles the SingleResult type marker, returning `T | undefined` for findOne() queries instead of always returning `Array<T>`. Changes: - Import InferResultType, SingleResult, NonSingleResult from @tanstack/db - Update UseLiveQueryReturn interface to use InferResultType<TContext> - Add UseLiveQueryReturnWithSingleResultCollection for singleResult collections - Add separate overloads for pre-created collections (NonSingleResult vs SingleResult) - Update runtime implementation to return first element for singleResult collections This aligns Vue adapter behavior with the React adapter. Fixes #1095
|
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 90.5 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 3.47 kB ℹ️ View Unchanged
|
Fixes #1095