Skip to content

59876 refactor(template): migrate template edit form to Formik#246

Open
aicarma-artyom-maslov wants to merge 41 commits into
masterfrom
frontend/template/59876__migrate_edit_form_to_formik
Open

59876 refactor(template): migrate template edit form to Formik#246
aicarma-artyom-maslov wants to merge 41 commits into
masterfrom
frontend/template/59876__migrate_edit_form_to_formik

Conversation

@aicarma-artyom-maslov

@aicarma-artyom-maslov aicarma-artyom-maslov commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Note

High Risk
Large behavioral change to template save, activation, and draft/discard semantics across kickoff, tasks, and settings; incorrect baseline or reinitialize merging could lose edits or double-save.

Overview
Moves the Edit Template page off Redux-as-source-of-truth for field edits onto a root Formik ITemplate state wrapped by TemplateForm, useTemplateForm, and TemplateFormPersistProvider. User edits go through useTemplateField / useTaskForm (with TaskFormScopeProvider); the persist provider diffs against a baseline, defers patchTemplate, mirrors saga isActive deactivation immediately, runs reference cleanup on kickoff/task changes, and supports consume / confirm / revert / abandon for activation and discard flows.

Refactors the page shell: TemplateEdit delegates init to useTemplateEditInit, task list CRUD to useTemplateEditTasks, and layout to TemplateEditLayout; TaskForm splits into header/sections hooks and reads kickoff/tasks/variables from Formik so conditions and return-to stay fresh before debounced Redux sync. Kickoff, TemplateSettings, TemplateControlls, and KickoffShareForm drop direct patchTemplate / template props in favor of form context; activation merges pending edits via consumePendingChanges. Autosave dispatches carry a requestId so stale responses after discard or superseding edits are ignored in the saga.

Tests cover persist, reinitialize, nested task paths, save retry, and useTaskForm; TaskRenderExtraFieldsInfo returns null when there are no output fields.

Reviewed by Cursor Bugbot for commit f0e60d9. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Migrate template edit form state management from Redux to Formik

  • Replaces inline Redux dispatch-based state in TemplateEdit with a Formik-backed form managed by useTemplateForm, TemplateForm, and TemplateFormPersistProvider, centralizing template field updates and autosave.
  • Task, kickoff, settings, and controls components now read and write form state via useTemplateField/useTaskForm context hooks instead of Redux props or patchTemplate dispatches.
  • Autosave is handled by TemplateFormPersistProvider, which diffs changes, debounces patches, de-duplicates in-flight saves by request ID, and supports confirm/revert flows for explicit saves.
  • Stale autosave requests are now tracked via persistRequest.ts and skipped in the saga when superseded; late create responses still attach IDs and redirect.
  • Fixes a runtime crash in WorkflowLogTaskComplete when currentTask.output is undefined.
  • Risk: form mount/unmount behavior changes across create-to-edit transitions due to key derivation from template.id or a session key; KickoffReduxContainer no longer receives a setKickoff prop.

Macroscope summarized f0e60d9.

Comment thread frontend/src/public/components/TemplateEdit/TaskForm/useTaskFormParts.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/TaskForm/useTaskFormParts.tsx Outdated
aicarma-artyom-maslov and others added 2 commits June 29, 2026 11:11
…ize persist

Wire task form sections through useTaskForm so fields read and write Formik state, and persist template changes from a single onChange path in TaskFormPersistProvider.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread frontend/src/public/components/TemplateEdit/TaskForm/useTaskForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/TaskForm/useTaskForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/TaskForm/useTaskForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/TaskForm/useTaskForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/TaskForm/useTaskForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/TaskForm/useTaskForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/useTemplateForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/TaskForm/container.ts
Comment thread frontend/src/public/components/TemplateEdit/useTemplateForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/useTemplateForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/useTemplateForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/TemplateEdit.tsx
Comment thread frontend/src/public/components/TemplateEdit/useTemplateForm.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/useTemplateEditInit.ts Outdated
Comment thread frontend/src/public/components/TemplateEdit/useTemplateEditInit.ts
Comment thread frontend/src/public/redux/template/saga.ts
Comment thread frontend/src/public/redux/template/saga.ts
Comment thread frontend/src/public/redux/template/saga.ts
Comment thread frontend/src/public/redux/template/saga.ts Outdated
Comment thread frontend/src/public/components/TemplateEdit/TemplateEdit.tsx Outdated
Comment thread frontend/src/public/components/TemplateEdit/useTemplateEditInit.ts Outdated
Comment thread frontend/src/public/components/TemplateEdit/useTemplateEditTasks.ts
…ive (#253)

Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 25aed62. Configure here.

Comment thread frontend/src/public/components/TemplateEdit/useTemplateEditInit.ts Outdated
…f github-work:pneumaticapp/pneumaticworkflow into frontend/template/59876__migrate_edit_form_to_formik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend Web client changes request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant