From 4472daa0d147091b73fcb011f8f63bd1a4ea91f2 Mon Sep 17 00:00:00 2001 From: Sergey Kozyrenko Date: Sat, 27 Jun 2026 15:45:58 +0700 Subject: [PATCH] refactor(knowledges): trim performSave doc-comment to the load-bearing invariant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drop the function-behavior restatement; keep the actionable invariant (navigation stays with the caller, else the guard↔onSaveFromDialog↔performSave cycle returns). Co-Authored-By: Claude Opus 4.8 --- frontend/src/features/knowledges/knowledge-form.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/src/features/knowledges/knowledge-form.tsx b/frontend/src/features/knowledges/knowledge-form.tsx index e6489cbd..9c79fee9 100644 --- a/frontend/src/features/knowledges/knowledge-form.tsx +++ b/frontend/src/features/knowledges/knowledge-form.tsx @@ -229,11 +229,9 @@ export function KnowledgeForm({ initialValues, isNew, knowledge, onSubmit }: Kno const { control, formState, handleSubmit, reset } = form; const { isDirty, isValid } = formState; - // Saves and resets the form; returns the page's submit result (with an - // optional `redirectTo`) so the *caller* owns navigation. Keeping navigation - // out of here lets `onSaveFromDialog` feed the guard without depending on - // `guard.skipNextBlock` — which would otherwise form a real cycle - // (guard ← onSaveFromDialog ← performSave ← guard.skipNextBlock). + // Navigation is the caller's job — it reads `redirectTo` off the returned result. + // Pulling it in here would make onSaveFromDialog depend on guard.skipNextBlock and + // form a real cycle (guard ← onSaveFromDialog ← performSave ← guard.skipNextBlock). const performSave = useCallback( async (values: FormValues): Promise => { try {