-
Notifications
You must be signed in to change notification settings - Fork 198
Open
Labels
bugSomething isn't workingSomething isn't working
Description
- [x ] I've validated the bug against the latest version of DB packages
Describe the bug
When using the latest react-db@0.1.78, createLiveQueryCollection with an electric collection returns inconsistent data. In my case, it returns 1/n items. On 0.1.77 it returns the full set.
const teamsWithUserCollection = createLiveQueryCollection({
getKey: i => i.team.id, // <------ this is now required to fetch all data correctly
query: (q) =>
q
.from({ team: teamCollection })
.join({ user: userCollection }, ({ user, team }) => eq(user.id, team.user_id))
.select(({ team, user }) => ({
team: team,
profile: user?.profile,
}))
})
export const useTeams = () => {
const { data, isLoading } = useLiveQuery(
(q) => {
return q.from({ teamWithUser: teamsWithUserCollection })
}
...
)Adding getKey fixed the issue.
Additional context
Testing all latest packages, but previous react-db@0.1.77 works without getKey
"@tanstack/db": 0.6.0
"@tanstack/electric-db-collection": 0.2.42
# "@tanstack/react-db": 0.1.78
"@tanstack/react-db": 0.1.77
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working