Extract shared JobScheduleField and JobAgentTypeField - #880
Merged
Conversation
The cron schedule block (input + validation error + humanSchedule preview + on-demand helper + Enabled switch) and the agent-type Select block were duplicated ~55 lines between jobs-add-dialog.tsx and jobs-settings-tab.tsx, differing only in input id and switch helper copy. Both now live in jobs-form-fields.tsx alongside the other shared job form fields. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 freeto 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.
What
Extracts two duplicated form-field blocks from
jobs-add-dialog.tsxandjobs-settings-tab.tsxintojobs-form-fields.tsx(which already hosts the other shared job form fields):JobScheduleField— cron input + validation error +humanSchedulepreview + "Leave blank for an on-demand job." helper + the Enabled switch. The two copies differed only in the input id and the switch helper copy (now aenabledHelperTextprop).JobAgentTypeField— theenabledAgentTypes.filter(isCliAgentType)shadcn Select. Identical in both files.Net -14 lines, and the two forms can no longer drift.
Why it's tech debt
Top item on the tech-debt backlog (2026-07-21 audit): ~55 lines duplicated between the two job forms. Any copy fix or behavior tweak had to be made twice.
Decision: not AgentTypeSelect
The backlog suggested checking whether these Select blocks could reuse the shared
AgentTypeSelect(PR #871). They can't without a behavior change:AgentTypeSelectis a cmdkCommandcombobox typed toAgentTypewithsortAgentTypesordering, while the job forms use the shadcnSelectprimitive constrained toCliAgentType. Swapping widgets would change UX and typing; this PR is housekeeping only, so the extraction keeps the existing shadcn Select. Only rendered delta: the settings-tab wrappers gainmin-w-0(no visual change; both parents are grids).Validation
pnpm run check,pnpm run finalize:webgreenQueued next
Next backlog item: extract
<MessageThreadAccordion>(agent-history-detail.tsx vs messages-panel.tsx, ~35 duplicated lines).🤖 Generated with Claude Code