-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: infinite hook detection #13755
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
base: main
Are you sure you want to change the base?
Conversation
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
I think we should be telling users that they need to pass |
@JarrodMFlesch The issue with passing the entire |
Should we just be recommending this? https://github.com/payloadcms/recursion-catcher/tree/main Or move that one into core? Either way, it feels like theses should be tracking recursion on documentID's. You may want to recursively update documents, its when you recursively read/update the same document that causes real issues. |
Adds the ability to detect infinite loops within hooks. This can occur if your hooks are self invoking, for example, as described here: https://payloadcms.com/docs/hooks/context#preventing-infinite-loops.
To prevent this, we track the number of operations made for each request, and throw an error before the server crashes.
To enable, use the
hooksMaxRecursion
property in your config:Note: to ensure that invocation counts are accurate, you must also pass the
context
object between Payload operations used within hooks (if applicable):Requires #13768 to add support for globals.