[GH-ISSUE #2774] [Issue]: Connection/preset editor UX nits — keystroke mutation storms, export-while-dirty, post-save flash, option-index race #1411

Closed
opened 2026-10-21 05:33:22 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Jun 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2774

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Lower-severity editor UX defects: per-keystroke mutation storms with lagging controlled inputs, an export-while-dirty footgun, a post-save blank-form flash, and a theoretical option-index race.

Sub-bug 1: Separator input mutation-per-keystroke (ux)

(a) The Separator input is fully controlled off lagging server state with no local draft/debounce; each keystroke PATCHes + double-invalidates + refetches, and mid-typing refetches reset the input -> dropped chars / caret jumps. It's the lone raw-controlled exception among the editor's free-text inputs (all others use local-draft + debounce).
(c) PresetEditor.tsx:1581/1813-1819; use-presets.ts:300. Kind: ux.

Sub-bug 2: Quick option-field edits race-revert (data-loss)

(a) Each OptionFieldInput debounces independently and onCommit rebuilds the WHOLE options array from a render-closure opts snapshot; with no optimistic update, a second field committing before the first's refetch lands writes a stale array, dropping the first edit.
(c) PresetEditor.tsx:1570-1598/1965-1989/2075-2131. Kind: new-bug (low/medium).

Sub-bug 3: Export omits unsaved edits (ux)

(a) Export calls api.download(.../export) which builds from the DB, bypassing unsaved local Overview/param state, with no dirty check.
(c) PresetEditor.tsx:382-402; prompts.routes.ts:42-57. Kind: ux.

Sub-bug 4: Post-save blank-form flash (ux)

(a) After saving a new custom agent, openAgentDetail(created.id) switches the id before the agents query refetches, so dbConfig is null and the populate effect blanks the whole form to 'New Agent' defaults until the refetch lands; an edit in that window applies to the reset form. Same pattern in AgentsPanel duplicate.
(c) AgentEditor.tsx:974-982/648-690/408-411; use-agents.ts:104-112; AgentsPanel.tsx:424-427. Kind: new-bug (low).

Sub-bug 5: Expanded option editor stale index (disputed)

(a) expandedOptIdx is a numeric index used for read/write; a reorder/shrink while open would mis-target. The pattern is real but all cited single-user triggers are refuted (alphabetical toggle doesn't reorder the editing array; the modal backdrop closes on any underlying interaction; value-edit refetch preserves order). Reachable only via a concurrent second client. Disputed/low.
(c) PresetEditor.tsx:1587/1991/2031-2042. Kind: disputed.

Suggested Fix

  • Separator: local-draft + commit-on-blur/debounce (mirror OptionFieldInput).
  • OptionFieldInput commit: functional patch by opt.id (or read latest from cache/ref), or add optimistic onMutate.
  • Export: if dirty, prompt to save / disable with tooltip.
  • New-agent save: seed the agents cache optimistically (setQueryData) or await the refetch before switching the detail id.
  • (Optional) Track expanded option by opt.id, not index.

Template

  • Separator input no longer drops chars / floods mutations
  • Quick option edits no longer revert each other
  • Export warns/blocks while dirty
  • New-agent save no longer flashes blank
  • pnpm check passes

Affected files

  • packages/client/src/components/presets/PresetEditor.tsx
  • packages/client/src/components/agents/AgentEditor.tsx
  • packages/client/src/components/agents/AgentsPanel.tsx

Audit provenance

Found by a multi-agent re-review of the connection/preset subsystem (editors UI + send-pipeline) against the merged staging tree (Round 1 + round-2 gap sweep + completeness critic, each finding adversarially verified). The prior #2656-#2668 fixes were re-verified as HELD on their primary paths. Severity: LOW.

AI-drafted from a static read; validation/test-plan boxes intentionally left UNCHECKED for a human to verify before close.

Originally created by @kolacheee on GitHub (Jun 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2774 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Lower-severity editor UX defects: per-keystroke mutation storms with lagging controlled inputs, an export-while-dirty footgun, a post-save blank-form flash, and a theoretical option-index race. ## Sub-bug 1: Separator input mutation-per-keystroke (ux) **(a)** The Separator input is fully controlled off lagging server state with no local draft/debounce; each keystroke PATCHes + double-invalidates + refetches, and mid-typing refetches reset the input -> dropped chars / caret jumps. It's the lone raw-controlled exception among the editor's free-text inputs (all others use local-draft + debounce). **(c)** PresetEditor.tsx:1581/1813-1819; use-presets.ts:300. Kind: ux. ## Sub-bug 2: Quick option-field edits race-revert (data-loss) **(a)** Each OptionFieldInput debounces independently and onCommit rebuilds the WHOLE options array from a render-closure `opts` snapshot; with no optimistic update, a second field committing before the first's refetch lands writes a stale array, dropping the first edit. **(c)** PresetEditor.tsx:1570-1598/1965-1989/2075-2131. Kind: new-bug (low/medium). ## Sub-bug 3: Export omits unsaved edits (ux) **(a)** Export calls `api.download(.../export)` which builds from the DB, bypassing unsaved local Overview/param state, with no dirty check. **(c)** PresetEditor.tsx:382-402; prompts.routes.ts:42-57. Kind: ux. ## Sub-bug 4: Post-save blank-form flash (ux) **(a)** After saving a new custom agent, `openAgentDetail(created.id)` switches the id before the agents query refetches, so dbConfig is null and the populate effect blanks the whole form to 'New Agent' defaults until the refetch lands; an edit in that window applies to the reset form. Same pattern in AgentsPanel duplicate. **(c)** AgentEditor.tsx:974-982/648-690/408-411; use-agents.ts:104-112; AgentsPanel.tsx:424-427. Kind: new-bug (low). ## Sub-bug 5: Expanded option editor stale index (disputed) **(a)** `expandedOptIdx` is a numeric index used for read/write; a reorder/shrink while open would mis-target. The pattern is real but all cited single-user triggers are refuted (alphabetical toggle doesn't reorder the editing array; the modal backdrop closes on any underlying interaction; value-edit refetch preserves order). Reachable only via a concurrent second client. Disputed/low. **(c)** PresetEditor.tsx:1587/1991/2031-2042. Kind: disputed. ## Suggested Fix - Separator: local-draft + commit-on-blur/debounce (mirror OptionFieldInput). - OptionFieldInput commit: functional patch by opt.id (or read latest from cache/ref), or add optimistic onMutate. - Export: if dirty, prompt to save / disable with tooltip. - New-agent save: seed the agents cache optimistically (setQueryData) or await the refetch before switching the detail id. - (Optional) Track expanded option by opt.id, not index. ## Template - [ ] Separator input no longer drops chars / floods mutations - [ ] Quick option edits no longer revert each other - [ ] Export warns/blocks while dirty - [ ] New-agent save no longer flashes blank - [ ] `pnpm check` passes --- ### Affected files - `packages/client/src/components/presets/PresetEditor.tsx` - `packages/client/src/components/agents/AgentEditor.tsx` - `packages/client/src/components/agents/AgentsPanel.tsx` ### Audit provenance Found by a multi-agent re-review of the connection/preset subsystem (editors UI + send-pipeline) against the merged `staging` tree (Round 1 + round-2 gap sweep + completeness critic, each finding adversarially verified). The prior #2656-#2668 fixes were re-verified as HELD on their primary paths. Severity: **LOW**. > AI-drafted from a static read; validation/test-plan boxes intentionally left UNCHECKED for a human to verify before close.
Author
Owner

@SpicyMarinara commented on GitHub (Jun 21, 2026):

Fixed in PR #2747. Verified the findings against the current branch and addressed the still-valid pieces: separator editing now uses the local draft/debounced input pattern, option label/value commits update by option id from the latest local options snapshot, preset export prompts to save dirty overview/parameter edits first, agent creation seeds the React Query caches before switching editor IDs, and the expanded option editor now tracks by option id instead of index. Full pnpm validation is running after the issue sweep, per maintainer request.

<!-- gh-comment-id:4763435948 --> @SpicyMarinara commented on GitHub (Jun 21, 2026): Fixed in PR #2747. Verified the findings against the current branch and addressed the still-valid pieces: separator editing now uses the local draft/debounced input pattern, option label/value commits update by option id from the latest local options snapshot, preset export prompts to save dirty overview/parameter edits first, agent creation seeds the React Query caches before switching editor IDs, and the expanded option editor now tracks by option id instead of index. Full pnpm validation is running after the issue sweep, per maintainer request.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1411
No description provided.