59876 frontend [ templates ] migrate template edit form to Formik - #246
Open
aicarma-artyom-maslov wants to merge 68 commits into
Open
59876 frontend [ templates ] migrate template edit form to Formik#246aicarma-artyom-maslov wants to merge 68 commits into
aicarma-artyom-maslov wants to merge 68 commits into
Conversation
aicarma-artyom-maslov
requested review from
EBirkenfeld,
Maria-Lordwill,
pneumatic-ilyacedrik and
pneumojoseph
June 29, 2026 07:59
…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>
…dateTask batching
…_to_formik # Conflicts: # frontend/src/public/components/Team/Users/CreateUserModal/__tests__/CreateUserModal.test.tsx # frontend/src/public/components/TemplateEdit/KickoffRedux/KickoffRedux.tsx # frontend/src/public/components/TemplateEdit/KickoffRedux/KickoffShareForm/KickoffShareForm.tsx # frontend/src/public/components/TemplateEdit/TaskForm/ReturnTo/ReturnTo.tsx # frontend/src/public/components/TemplateEdit/TaskForm/TaskForm.tsx # frontend/src/public/components/TemplateEdit/TaskForm/TaskPerformers.tsx # frontend/src/public/components/TemplateEdit/TaskForm/__tests__/TaskPerformers.test.tsx # frontend/src/public/components/TemplateEdit/TaskForm/container.ts # frontend/src/public/components/TemplateEdit/TaskRenderExtraFieldsInfo/TaskRenderExtraFieldsInfo.tsx # frontend/src/public/components/TemplateEdit/TemplateControlls/TemplateControlls.tsx # frontend/src/public/components/TemplateEdit/TemplateEdit.tsx # frontend/src/public/components/TemplateEdit/TemplateSettings/TemplateSettings.tsx # frontend/src/public/components/Workflows/WorkflowLog/WorkflowLogEvents/WorkflowLogTaskComplete/WorkflowLogTaskComplete.tsx # frontend/src/public/components/Workflows/WorkflowLog/WorkflowLogEvents/WorkflowLogTaskComplete/__tests__/WorkflowLogTaskComplete.test.tsx # frontend/src/public/redux/selectors/template.ts # frontend/src/public/redux/template/__tests__/saga.test.ts # frontend/src/public/redux/template/actions.ts # frontend/src/public/redux/template/saga.ts
…9876__migrate_edit_form_to_formik
…9876__migrate_edit_form_to_formik
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 09a07e5. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Note
High Risk
Large change to how templates are edited, autosaved, and activated; incorrect persist or merge logic could lose edits or save stale state.
Overview
Template editing now keeps kickoff, tasks, and settings in a root Formik
TemplateForminstead of dispatchingsetTemplate/patchTaskfrom each child.TemplateEditwiresuseTemplateForm,useTemplateEditInit, anduseTemplateEditTasks; task/kickoff/settings components read and write viauseTemplateField,useTaskForm, andTaskFormScopeProvider, with autosave handled by the persist layer (debounced saves and pending-change handling on enable/run).Containers (
WorkflowTaskFormContainer,KickoffReduxContainer,TemplateControllsContainer) stop usingconnectand mostly re-export the presentational components, which resolve data from context or optional props.KickoffReduxandTemplateControllsuse wrapper/content splits so hooks stay stable when template context is missing.Refactors:
TaskFormis split into header/sections hooks;ReturnTo/TaskPerformersupdate tasks throughuseTaskForm.KickoffShareFormreads sharing fields from form values, batches updates withsetValues, and moves shared/embedded UI intoKickoffShareTabswith new tests.TemplateControllsis split into navigation, owners, notifications, and run/enable sections, merging pending form edits when activating.FileOutputuses adivwrapper instead ofpfor attachment markup.Tests add coverage for Formik persist, share-form sync, hook-order guards, run-workflow without
templateId, and RTLacthelpers in several suites.Reviewed by Cursor Bugbot for commit 5fdbc0f. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Migrate template edit form to Formik with context-driven state management
TemplateFormcontext, routing all task and template field edits through form state viauseTemplateFieldanduseTaskFormhooks.useTemplateFormto initialize and manage the Formik instance, preserve unsaved edits across Redux updates, apply reference cleanup, and trigger immediate deactivation when relevant fields change.useTemplatePersistContextValueto coordinate autosave dispatches with debouncing and generation-scoped request tracking (persistRequest.ts) so stale autosave responses are discarded.TemplateEdit,TemplateControlls,TaskForm, andKickoffReduxinto focused hooks and components (useTemplateEditInit,useTemplateEditTasks,TaskFormHeader,TaskFormSections,TemplateNavigation, etc.) that read from Formik context instead of Redux props.TemplateControllsContainer,KickoffReduxContainer,WorkflowTaskFormContainer) no longer inject Redux props viaconnect; consumers relying on those mapped props will receiveundefinedunless the component can resolve values from internal selectors or context.Changes since #246 opened
setSettingsFieldValueinTemplateControllsto dispatchpatchTemplatewhen Formik field context is absent [6037911]TemplateEdit.testsuite to use new selector mocks and test kickoff changes via a mockedKickoffReduxbutton [6517142]KickoffOutputs.FileOutputcomponent outer container from paragraph to div element [6517142]useTemplateEditInithook to pass a constrained object containingkickoff,tasks, andtemplateIdtogetVariablesinstead of passing the entirecurrentValuesobject, enabling variable metadata construction with knowledge of thetemplateId[82e3be2]TemplateEdit.test.tsxto verify thattemplateIdis correctly propagated through variable synchronization and appears in variable metadata [82e3be2]KickoffShareFormcomponent to derive UI state from template form values instead of local state, synchronizing active tab with sharing flags and persisting success URL changes immediately [3cff7af]KickoffShareFormcomponent with mocked dependencies and test cases verifying success URL enablement reflection and active tab switching behavior [3cff7af]KickoffShareFormcomponent for redirect URL functionality [480c3c0]KickoffShareFormtest suite [480c3c0]consumePendingChangescallback withinuseTemplatePersistContextValuehook to clear pendingisActivedeactivation flag when an explicit activation is applied [6b7e3a9]TemplateFormPersistProvidertest suite verifying pending deactivation does not persist after successful activation reinitialize [6b7e3a9]KickoffShareFormcomponent at/components/TemplateEdit/KickoffRedux/KickoffShareForm/from individualsetFieldValuecalls to batchsetValuesupdates for template field modifications [4819f51]KickoffShareFormcomponent to support and verify batch form state updates [4819f51]TSetValuestype signature inuseTemplateFormto accept either anITemplateClientobject or a function that receives current values and returnsITemplateClient, and implemented functional updater support inuseTemplateFormHook.tssetValuescallback by computing current values from Formik values overlaid with pending edits, invoking the function or using the object directly, applyingapplyImmediateDeactivation, updatingpendingUserEditsRefviagetChangedFields, and callingcurrentFormik.setValueswith the result. [033b872]KickoffShareFormcomponent'seditTemplatehelper to callsetValueswith a functional updater that receivescurrentValuesand mergestemplateFieldsinto it, replacing the previous approach of spreading from the capturedvaluesvariable. [033b872]KickoffShareForm.test.tsxby updatingrenderShareFormto provide and return a mocksetValues, modifyingStatefulShareFormcontextsetValuesto support functional updaters by applying function arguments to current state, adding test case 'preserves synchronous edits that are newer than context values' to verify functional updater behavior, and updatingrerenderWithValuesto reuse the samesetValuesmock. [033b872]useTemplateForm.test.tsxby extendingISpyHandletype to includesetValues, capturingsetValuesfromuseTemplateFieldinTemplateFormHarnessSpy, and adding test case 'applies functional full-form updates over synchronous pending edits' that performssetFieldValuefollowed bysetValueswith a functional updater and asserts both changes are present. [033b872]TemplateControllscomponent'shandleRunProcesshandler to exit early whentemplateIdis falsy, preventing execution of dataset loading, workflow computation, and modal opening [bfad8e7]lastTemplateIdentityRef.currentassignment inuseTemplateFormhook to execute after identity-change check and form reset on every render [bfad8e7]useTemplateEditInithook to track the last persisted template ID instead of a boolean sync flag and trigger immediate variables sync whenever the template ID changes [f7b0b08]TemplateEditcomponent [f7b0b08]KickoffReduxandTemplateControllscomponents to split each into a wrapper component and a content component [107f9e4]useTemplateEditInithook to skip users-dependent effect on initial mount [107f9e4]resolveTemplateFormMountKeyfunction intemplateFormUtilsand refactoredTemplateEditcomponent to use it for determiningTemplateFormmount keys [5fdbc0f]templateFormUtilscoveringhasTemplateIdentityChangedandresolveTemplateFormMountKeyfunctions [5fdbc0f]Macroscope summarized 09a07e5.