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

PCE: Query extensions of $queryRawUnsafe also triggers $allModels.$allOperations #19550

Closed
millsp opened this issue May 31, 2023 · 2 comments · Fixed by #19625
Closed

PCE: Query extensions of $queryRawUnsafe also triggers $allModels.$allOperations #19550

millsp opened this issue May 31, 2023 · 2 comments · Fixed by #19625
Assignees
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: clientExtensions
Milestone

Comments

@millsp
Copy link
Member

millsp commented May 31, 2023

Don't know if it is wanted by design, but I was surprised by the following:

In that kind of setup:

const xprisma = prisma.$extends({
  query: {
    $queryRawUnsafe({ args, query, operation }) {
      // A
      return query(args);
    },
    $allModels: {
      $allOperations({ model, operation, args, query }){
        // B
        return query(args);
      },
    },
  },
})

When xprisma.$queryRawUnsafe is used, both A and B are executed, $allOperations receiving undefined model and $queryRawUnsafe operation.

It isn't very logical IMO, when I add something into $allModels, I don't expect that it will also concern the top-level raw queries.

Originally posted by @Maxime-J in #16500 (comment)

@millsp millsp added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: clientExtensions labels May 31, 2023
@millsp millsp self-assigned this Jun 1, 2023
@millsp
Copy link
Member Author

millsp commented Jun 1, 2023

Add missing top-level $allOperations

@millsp
Copy link
Member Author

millsp commented Jun 1, 2023

Mention that in the release notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: clientExtensions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants