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: allow mutation selection without passing a patch builder #964

Conversation

nkgentile
Copy link
Contributor

@nkgentile nkgentile commented Jan 9, 2025

Fixes a bug when using the mutation selector syntax in a transaction, and adjusts the types and overloaded patch method.

Previously, this would work as expected (with type errors):

client.transaction().patch(
  {
    query: '*[_id in $ids]',
    params: {ids: ['abc123', 'foo.456']},
  },
  (p) => p.inc({count: 1}),
)

But this wouldn't:

client.transaction().patch(
  {
    query: '*[_id in $ids]',
    params: {ids: ['abc123', 'foo.456']},
  },
  {inc: {count: 1}},
)

@nkgentile nkgentile force-pushed the fix/add-patch-selection-to-transaction-types branch from adeeea3 to c51be8b Compare January 10, 2025 18:54
@nkgentile nkgentile marked this pull request as ready for review January 10, 2025 18:55
@nkgentile nkgentile force-pushed the fix/add-patch-selection-to-transaction-types branch from c51be8b to 4b2fc62 Compare January 10, 2025 19:01
@nkgentile nkgentile force-pushed the fix/add-patch-selection-to-transaction-types branch from 4b2fc62 to aa30bac Compare January 10, 2025 19:01
Copy link
Member

@cngonzalez cngonzalez left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me!

@cngonzalez cngonzalez added this pull request to the merge queue Jan 16, 2025
Merged via the queue into sanity-io:main with commit fd70208 Jan 16, 2025
13 checks passed
@ecospark ecospark bot mentioned this pull request Jan 16, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants