You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plans/issue-1130-fsm-modal-reload.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ The user-visible proof is simple: in a dev modal that currently jumps (the exist
18
18
-[x] (2026-03-05 06:15Z) Integrated reload controller into scoped modals (`ChoiceBuilder`, Macro settings modals, AI settings modals) and replaced direct full-refresh `reload()` implementations.
19
19
-[x] (2026-03-05 06:16Z) Verified with `bun run test`, `bun run build`, `bun run build-with-lint`, and Obsidian CLI runtime probes in `vault=dev`.
20
20
-[x] (2026-03-05 06:44Z) Hardened reload queue handling by replacing recursive pending-reload replay with iterative draining and added two regression tests for re-entrant/coalesced reload requests.
21
+
-[x] (2026-03-05 07:56Z) Implemented phase-2 in-place UI updates for AI command settings modals so `Show advanced settings` no longer triggers full modal reload, and removed non-infinite model-change/name-edit reloads by refreshing UI elements directly.
21
22
22
23
## Surprises & Discoveries
23
24
@@ -39,6 +40,9 @@ The user-visible proof is simple: in a dev modal that currently jumps (the exist
39
40
- Observation: `requestReload()` can be called re-entrantly during `render()`, so pending replay should avoid recursion.
40
41
Evidence: added tests where render triggers queued reload(s), asserting two render passes and latest-reason coalescing.
41
42
43
+
- Observation: `Show advanced settings` can be updated as a local section re-render without changing surrounding settings rows.
44
+
Evidence: CLI probe in `quickadd:testQuickAdd` showed `scrollTop` remained `220` and active element stayed `TEXTAREA` while modal height increased after toggle.
45
+
42
46
## Decision Log
43
47
44
48
- Decision: implement an explicit finite state machine (FSM) for modal reload lifecycle instead of direct `contentEl.empty(); display();` calls.
@@ -61,6 +65,10 @@ The user-visible proof is simple: in a dev modal that currently jumps (the exist
61
65
Rationale: iterative draining preserves behavior while removing recursive call chains during re-entrant reload scenarios.
62
66
Date/Author: 2026-03-05 / Codex
63
67
68
+
- Decision: convert advanced-settings visibility in AI command settings modals from full reload to in-place section rendering.
69
+
Rationale: this is a high-frequency interaction and does not require rebuilding unrelated controls; local re-render removes unnecessary modal churn.
70
+
Date/Author: 2026-03-05 / Codex
71
+
64
72
## Outcomes & Retrospective
65
73
66
74
Implemented outcome matches purpose: reload-driven modal jumps are now handled through an FSM-based controller that captures and restores UI position. Scoped modal classes no longer call direct full-refresh reload logic without restoration.
@@ -72,8 +80,9 @@ Validation results:
72
80
-`bun run build-with-lint`: passed.
73
81
- Obsidian CLI runtime probe (`vault=dev`) confirms preserved scroll/focus on model-change reload in the test modal.
74
82
- Post-merge hardening: `modalReloadMachine` now has 6 passing tests, including queued and coalesced reload behavior during render re-entrancy.
83
+
- Phase-2 follow-up: `Show advanced settings` in both AI command settings modals now updates in place (no full reload); CLI probe confirms stable scroll/focus with non-zero scroll range.
75
84
76
-
Remaining gap: this change stabilizes reload behavior, but does not yet eliminate reloads entirely. Follow-up work can convert high-churn sections to fine-grained updates to reduce rerenders further.
85
+
Remaining gap: this change reduces reload frequency in AI command settings flows but does not eliminate reloads across all modal classes. Further follow-up can convert additional conditional UI paths (for example `CaptureChoiceBuilder`, `TemplateChoiceBuilder`, and provider/model editors) to fine-grained section updates.
77
86
78
87
## Context and Orientation
79
88
@@ -274,3 +283,4 @@ Integration rule for every migrated modal:
274
283
Revision Note (2026-03-05): Initial ExecPlan created in response to issue #1130 and user request to pursue an FSM-based solution rather than ad-hoc `reload()` calls.
275
284
Revision Note (2026-03-05): Updated after implementation to reflect completed milestones, final validation evidence, and runtime probe adjustments needed to distinguish true preservation from expected scroll clamping.
276
285
Revision Note (2026-03-05): Updated after merge with queue-drain hardening and additional controller regression tests for re-entrant reload requests.
286
+
Revision Note (2026-03-05): Updated for phase-2 partial migration that removes full reloads from advanced-settings toggles in AI command settings modals and records new CLI evidence.
0 commit comments