Repository navigation
fix(go-agent-web): correct BGPT canvas form watcher usage - #16682
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesBGPT Form Watch Update
Estimated code review effort: 1 (Trivial) | ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes a page crash when opening the BGPT node configuration in the canvas.
Root Cause
BGPT was using the tool-form watcher call pattern in a normal canvas component form.
Tool forms use:
useWatchFormChange(form)
Canvas component forms use:
useWatchFormChange(node?.id, form)
Tool is not equal to component. The BGPT canvas component imported the component-level hook but called it like a tool-form hook, so the form argument became undefined and React Hook Form tried to read control from a null context.
Change
Updated the BGPT canvas form to pass the node id and form instance correctly.
Validation
Ran ESLint for the changed file:
npx eslint src/pages/agent/form/bgpt-form/index.tsx