-
Notifications
You must be signed in to change notification settings - Fork 90
expand useLiveQuery
callback to support conditional queries and additional return types
#535
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
Conversation
🦋 Changeset detectedLatest commit: 13d9d0d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-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: |
…itional return types
8648213
to
24fccb5
Compare
Size Change: 0 B Total Size: 68.4 kB ℹ️ View Unchanged
|
Size Change: 0 B Total Size: 1.18 kB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks great!
if (result === undefined || result === null) { | ||
// Callback returned undefined/null - disabled query | ||
collectionRef.current = null | ||
} else if (result instanceof CollectionImpl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be nice to have a isCollection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left isCollection and isQueryBuilder for a followup, there is some ambiguity on when each should be set as everything becomes a collection at the end.
// Callback returned a Collection instance - use it directly | ||
result.startSyncImmediate() | ||
collectionRef.current = result | ||
} else if (result instanceof BaseQueryBuilder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and isQueryBuilder
No description provided.