req.payload should be bound to the request's transaction in hooks #13261
macrozone
started this conversation in
Feature Requests & Ideas
Replies: 1 comment
-
This explains a lot... yea I also expected that it would be automatically set |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
currently, if you want to do another db request in a collection, you may run into foreign key constraints or similar, because the record may not be created until the transaction finishes.
https://payloadcms.com/docs/database/transactions
you have to pass req, otherwise its not using the transaction:
this looks like an api design misstake and is a pitfall. Because you are using payload from req., you may expect it to be bound to the current request, while in reality, its not.
Beta Was this translation helpful? Give feedback.
All reactions