Skip to content

revert(gui): remove modal reload refactor series#1137

Merged
chhoumann merged 5 commits intomasterfrom
revert-ui-reload-churn
Mar 5, 2026
Merged

revert(gui): remove modal reload refactor series#1137
chhoumann merged 5 commits intomasterfrom
revert-ui-reload-churn

Conversation

@chhoumann
Copy link
Owner

@chhoumann chhoumann commented Mar 5, 2026

Revert the modal reload refactor series introduced in #1132, #1133, #1134, #1135, and #1136.

The combined result of that series was a more complex reload architecture built around the modal reload machine and a set of follow-up in-place UI updates. We do not want that direction in the codebase, so this PR removes the whole series rather than trying to preserve pieces of it.

This branch returns the repository to the exact tree from before #1132 landed. In practice that means:

  • removing the modal reload machine and its regression tests
  • restoring the previous modal reload behavior in the affected GUI paths
  • removing the related execution plan document
  • dropping the xstate dependency that was only needed for this work

Validation on this revert branch:

  • bun run test
  • bun run build-with-lint

Focused review note: the important property here is not the individual file diff, but that HEAD matches the pre-series tree exactly.


Open with Devin

Summary by CodeRabbit

  • Chores

    • Removed external state management dependency.
    • Simplified internal modal reload architecture across multiple modal components.
    • Cleaned up associated test files and planning documentation.
  • Refactor

    • Unified modal re-rendering logic to use direct content refresh instead of deferred rendering workflows.

@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
quickadd Ready Ready Preview Mar 5, 2026 8:48pm

@chhoumann chhoumann marked this pull request as ready for review March 5, 2026 20:48
@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c10afae7-0431-49c6-88d7-095c0a7c1297

📥 Commits

Reviewing files that changed from the base of the PR and between 818272a and 4d5b6c3.

⛔ Files ignored due to path filters (1)
  • bun.lockb is excluded by !**/bun.lockb
📒 Files selected for processing (14)
  • package.json
  • plans/issue-1130-fsm-modal-reload.md
  • src/gui/AIAssistantProvidersModal.ts
  • src/gui/AIAssistantSettingsModal.ts
  • src/gui/ChoiceBuilder/captureChoiceBuilder.ts
  • src/gui/ChoiceBuilder/choiceBuilder.ts
  • src/gui/ChoiceBuilder/templateChoiceBuilder.ts
  • src/gui/MacroGUIs/AIAssistantCommandSettingsModal.ts
  • src/gui/MacroGUIs/AIAssistantInfiniteCommandSettingsModal.ts
  • src/gui/MacroGUIs/ConditionalCommandSettingsModal.ts
  • src/gui/MacroGUIs/MacroBuilder.ts
  • src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts
  • src/gui/utils/modalReloadMachine.test.ts
  • src/gui/utils/modalReloadMachine.ts

📝 Walkthrough

Walkthrough

This PR removes the xstate-based ModalReloadController FSM machinery and replaces controller-driven modal reload orchestration with simpler direct re-rendering via display() calls across all affected modal components and choice builders.

Changes

Cohort / File(s) Summary
Dependency & Documentation Removal
package.json, plans/issue-1130-fsm-modal-reload.md
Removed xstate dependency and deleted the comprehensive FSM modal reload execution plan document.
Core FSM Implementation
src/gui/utils/modalReloadMachine.ts, src/gui/utils/modalReloadMachine.test.ts
Completely removed the xstate-based ModalReloadController class, state machine types, focus/scroll snapshot logic, and all associated unit tests (732 lines total).
Assistant Modal Components
src/gui/AIAssistantProvidersModal.ts, src/gui/AIAssistantSettingsModal.ts, src/gui/MacroGUIs/AIAssistantCommandSettingsModal.ts, src/gui/MacroGUIs/AIAssistantInfiniteCommandSettingsModal.ts
Removed ModalReloadController usage; replaced controller-driven reloads with direct content clearing and display() re-rendering; removed lifecycle destroy() calls.
Conditional & File Command Modals
src/gui/MacroGUIs/ConditionalCommandSettingsModal.ts, src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts
Removed container-based rendering logic; simplified to direct conditional UI element attachment to contentEl; replaced targeted renderX() methods with full reload() via display().
Macro Builder
src/gui/MacroGUIs/MacroBuilder.ts
Removed ModalReloadController initialization and destroy; simplified reload() to directly destroy commandEditor and call display().
Choice Builder Components
src/gui/ChoiceBuilder/choiceBuilder.ts, src/gui/ChoiceBuilder/captureChoiceBuilder.ts, src/gui/ChoiceBuilder/templateChoiceBuilder.ts
Removed ModalReloadController-based reload; simplified addOpenFileSetting() signature (now single string argument only); introduced new addFileOpeningSetting() method for conditional file-opening UI; standardized rendering to use contentEl directly.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

released

Poem

🐰 A rabbit hops, FSM fades away,
Simple paths replace the complex play,
Display() calls, reload, that's all—
No state machines, just a cleaner sprawl! 🎉

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-ui-reload-churn

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chhoumann chhoumann merged commit 3ba1a73 into master Mar 5, 2026
3 of 5 checks passed
@chhoumann chhoumann deleted the revert-ui-reload-churn branch March 5, 2026 20:48
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d5b6c306b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

this.reloadController.destroy();
this.resolvePromise(this.providers);

Choose a reason for hiding this comment

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

P1 Badge Return immediately after reopening provider list

When onClose() is triggered while editing a provider (this.selectedProvider is set), the method now falls through to resolvePromise/super.onClose after calling this.open(). This closes the modal instead of returning to the provider list and can persist in-progress edits that users expected to discard (e.g., pressing Esc/X or Cancel-with-changes path), which is a behavior regression from the previous flow.

Useful? React with 👍 / 👎.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment on lines 377 to 383
this.selectedProvider = null;
this.reload();
this.open();
return;
}

this.reloadController.destroy();
this.resolvePromise(this.providers);
super.onClose();
Copy link
Contributor

Choose a reason for hiding this comment

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

🔴 Missing early return in AIAssistantProvidersModal.onClose() causes premature promise resolution and modal teardown

The revert removed the return statement from the if (this.selectedProvider) branch in onClose(). Previously (src/gui/AIAssistantProvidersModal.ts:388), when a user closed the modal while editing a provider, the code would set selectedProvider = null, reload to show the providers list, reopen the modal, and return — preventing resolvePromise and super.onClose() from executing. Now, after the reopen, execution falls through to this.resolvePromise(this.providers) and super.onClose(), which prematurely resolves the waitForClose promise (signaling the caller that the user is done) and tears down the modal. The caller at src/gui/AIAssistantSettingsModal.ts:68-72 will process the returned providers and reload its own UI while the providers modal is still supposed to be open.

(Refers to lines 374-383)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

github-actions bot pushed a commit that referenced this pull request Mar 5, 2026
# [2.12.0](2.11.0...2.12.0) (2026-03-05)

### Bug Fixes

* **capture:** preserve canvas tab indentation on configured writes ([#1125](#1125)) ([0a1578e](0a1578e))
* disallow capture targets with .base extension ([cb39ed4](cb39ed4))
* **field-suggestions:** opt-in inline values from fenced code blocks ([#1128](#1128)) ([8597905](8597905))
* **gui:** preserve modal edit position during settings reload ([#1132](#1132)) ([11bda19](11bda19))
* **gui:** reduce ai settings modal reload churn ([#1134](#1134)) ([ae0f7a1](ae0f7a1))
* **gui:** reduce choice builder reload churn ([#1136](#1136)) ([818272a](818272a))
* **gui:** reduce macro settings modal reload churn ([#1135](#1135)) ([a1a6271](a1a6271))
* harden existing-tab matching and document issue workflow ([#1108](#1108)) ([7b12d3b](7b12d3b))
* make template path resolution deterministic ([3297d54](3297d54))
* normalize capture title for non-markdown targets ([964d672](964d672))
* preserve capture-format spacing for insert-at-end ([#1119](#1119)) ([8bb8ed4](8bb8ed4))
* preserve explicit capture target file extensions ([57e43ff](57e43ff))
* preserve insert-at-end order for non-newline captures ([#1120](#1120)) ([e7cbbf2](e7cbbf2))
* resolve template file-name paths without duplicate default folder ([7bfd41b](7bfd41b))
* resolve vault-relative template paths using root folders ([81216de](81216de))

### Features

* add AI request logging API and reduce assistant log noise ([#1110](#1110)) ([2c36800](2c36800))
* automate docs version snapshot during release ([#1111](#1111)) ([1571846](1571846))
* **capture:** fully support capture into canvas cards ([#1124](#1124)) ([a53f889](a53f889))
* **cli:** add native QuickAdd Obsidian CLI handlers ([#1129](#1129)) ([8102d47](8102d47))
* **format:** support mapped VALUE suggester display text ([#1127](#1127)) ([b8ec56c](b8ec56c))
* **macro:** add editor cursor navigation commands ([101d5f6](101d5f6))
* support .base template files for template choices ([11e6490](11e6490))

### Reverts

* **gui:** remove modal reload refactor series ([#1137](#1137)) ([3ba1a73](3ba1a73)), closes [#1136](#1136) [#1135](#1135) [#1134](#1134) [#1133](#1133) [#1132](#1132)
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🎉 This PR is included in version 2.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🚀 Release has been published: v2.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant