mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-31 06:04:11 +01:00
Creating an agent rendered a blank page (now a "Maximum update depth exceeded" error card). `triggerTestEnvironment` was rebuilt every render because `runEnvironmentTest` depends on the `useMutation` result object, which gets a fresh identity each render. The `onTestActionChange` effect then fired every render and pushed a new function into the parent's state (setTestAgentAction), forcing another render — an infinite loop. Hold the latest trigger behavior in a ref and hand the parent a stable callback so the effect runs once. The Test Agent button still invokes the current logic via the ref.