You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let me first start with the reproduction case before getting into more details:
First start a payload.find() over a collection with several matching documents.
Context is empty here.
Payload fetches all documents and executes all collection hooks for those documents.
In a collection hook we call payload.findById({ context: { value: 5 }, req }). A context value is set and req is passed (using shared transactions for instance).
So far so good for the first document of the payload.find() operation but in the hooks for the second and later documents context.value is now 5 right away.
Payload should not use the same context object through all hook operations. Context values passed to sub operations should not influence the context values are previous or still ongoing operations like the payload.find() one.
On first glance, this makes sense to me. You want the context to follow through explicitly where you passed it, but right now, it's shared across all operations.
We will need to think through this one to make sure that we can change this without any negative repercussions.
Describe the Bug
Let me first start with the reproduction case before getting into more details:
Payload should not use the same context object through all hook operations. Context values passed to sub operations should not influence the context values are previous or still ongoing operations like the payload.find() one.
Link to the code that reproduces this issue
https://github.com/cbratschi/payload
Reproduction Steps
See above.
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
The text was updated successfully, but these errors were encountered: