Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
docs(knowledge): explain skipNextBlockRef cycle in KnowledgeForm
Sergey Kozyrenko08fe65892515
diff --git a/frontend/src/pages/knowledges/knowledge.tsx b/frontend/src/pages/knowledges/knowledge.tsxindex 1255485e..e816e604 100644--- a/frontend/src/pages/knowledges/knowledge.tsx+++ b/frontend/src/pages/knowledges/knowledge.tsx@@ -752,6 +752,17 @@ const KnowledgeFormView = ({ initialValues, isNew, knowledge, knowledgeName, onS[navigate, onSubmit, reset],);+ // The ref below breaks an otherwise circular hook dependency:+ //+ // performSave → skipNextBlockRef.current() (ref filled by effect below)+ // onSaveFromDialog → performSave+ // useUnsavedChangesGuard({ onSave: onSaveFromDialog }) → exposes skipNextBlock+ // useEffect → wires the exposed skipNextBlock back into the ref+ //+ // Replacing the ref with a plain dep would force `performSave` to depend+ // on `guard.skipNextBlock`, which is produced by a hook (`guard`) whose+ // own input (`onSave`) closes over `performSave` — a real cycle that+ // can't be expressed in deps without `useRef`.const skipNextBlockRef = useRef<() => void>(() => {});const onSubmitWithGuard: SubmitHandler<FormValues> = useCallback(