Skip to content
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

Fix instaql with reverse references #522

Merged
merged 2 commits into from
Nov 22, 2024
Merged

Fix instaql with reverse references #522

merged 2 commits into from
Nov 22, 2024

Conversation

dwwoelfel
Copy link
Contributor

Fixes Cam's $isNull bug.

We weren't handling reverse references correctly. Before this PR you can't use the linked field name in the where without the .id:

{bookshelves: {$: {where: {users: myUserId}}}}

(bookshelves.users is the reverse link to users.bookshelves).

You could leave off the .id in the forward direction:

{users: {$: {where: {bookshelves: bookshelfId}}}}

Now both directions are supported.

Also fixes how we check $isNull for reverse references, copying the same strategy we use on the server.

We actually patched this same issue on the server as part of the isNull PR #409, but didn't think to check if it was a problem on the client.

Copy link

View Vercel preview at instant-www-js-fix-references-jsv.vercel.app.

Copy link
Contributor

@stopachka stopachka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Niice!

@dwwoelfel dwwoelfel merged commit 7f9d164 into main Nov 22, 2024
26 checks passed
@dwwoelfel dwwoelfel deleted the fix-references branch November 22, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants