-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(client): Ensure result extensions are applied after all query extensions #20438
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
73cecc6 to
5585688
Compare
…ensions (prisma#20438) * fix(client): Ensure result extensions are applied after all query extensions Fix prisma#20437 * Move recursive `applyExtensions` into it's own module
Problem: after #20438, we were trying to apply result extensions to "sugared" result of `.count` method - plain number. Theoretically, extensions should not apply there at all, but field with no `needs` applies to every result of a corresponding model. And since result extensions use proxies and proxy can not be created over non-objects, the code thrown very undescriptive error instead. Fix #20499
* fix(client): Make sure result extensions don't break `.count` Problem: after #20438, we were trying to apply result extensions to "sugared" result of `.count` method - plain number. Theoretically, extensions should not apply there at all, but field with no `needs` applies to every result of a corresponding model. And since result extensions use proxies and proxy can not be created over non-objects, the code thrown very undescriptive error instead. Fix #20499 * Update packages/client/src/runtime/core/extensions/applyAllResultExtensions.ts Co-authored-by: Joël Galeran <[email protected]> --------- Co-authored-by: Joël Galeran <[email protected]>
* fix(client): Make sure result extensions don't break `.count` Problem: after #20438, we were trying to apply result extensions to "sugared" result of `.count` method - plain number. Theoretically, extensions should not apply there at all, but field with no `needs` applies to every result of a corresponding model. And since result extensions use proxies and proxy can not be created over non-objects, the code thrown very undescriptive error instead. Fix #20499 * Update packages/client/src/runtime/core/extensions/applyAllResultExtensions.ts Co-authored-by: Joël Galeran <[email protected]> --------- Co-authored-by: Joël Galeran <[email protected]>
|
@SevInf I am not sure about the original intention but I assume, that the result extensions should also work for nested queries as well. At the moment if the model is loaded through a select, then the result extensions are not applied because the model is the "parent" model. See my comment for a bit more detail: prisma/docs#5217 (comment) What would be a good next step here? |
|
@greg-nagy Result extensions are intended to work with nested read and writes and we have several tests for that inside of our repo. If that's not the case - please, open a separate issue and share all reproduction steps. |
|
thanks for the response!
That doesn't seem to be the case — although I am 1 version behind atm. I will create reproduction steps and open an issue when I get there.
Might be the case easily. Thanks for the clarification. I just checked the last PR that changed the relevant parts. |
|
@SevInf You have just updated your docs with this limitation https://github.com/prisma/docs/pull/5246/files Does this mean that you are aware of the issue and no need to open a new issue from me? |
|
@greg-nagy, no, I believe that doc change was incorrect, we are working on it. |
Fix #20437
/integration