Skip to content

fix: wizard UI stops updating when opened as modal dialog (CRW-12139) - #358

Open
vrubezhny wants to merge 1 commit into
redhat-developer:mainfrom
vrubezhny:fix/modal-wizard-edt-dispatch
Open

fix: wizard UI stops updating when opened as modal dialog (CRW-12139)#358
vrubezhny wants to merge 1 commit into
redhat-developer:mainfrom
vrubezhny:fix/modal-wizard-edt-dispatch

Conversation

@vrubezhny

Copy link
Copy Markdown
Collaborator

The server selection and workspace selection wizard pages use EDT dispatch (invokeLater, runInEdt, withContext(Dispatchers.EDT)) to update UI components — cluster dropdown, DevWorkspace list, button states, and workspace status icons. These calls default to ModalityState.nonModal(), which defers execution until the modal dialog closes. This causes the UI to freeze when the wizard runs as a modal dialog (File -> Remote Development -> Connect to Dev Spaces), while working fine in non-modal mode (Run Plugin task).

Use ModalityState.any() for all EDT dispatch in the wizard steps and the DevWorkspaceWatcher so that UI updates execute regardless of the current modal context.

Fixes: https://redhat.atlassian.net/browse/CRW-12139

Assisted-By: Claude Opus 4.6 noreply@anthropic.com

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@vrubezhny, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 28cbc4d4-d863-42b3-9c14-fc8868d90ce7

📥 Commits

Reviewing files that changed from the base of the PR and between 6ca7089 and d2e12a6.

📒 Files selected for processing (3)
  • src/main/kotlin/com/redhat/devtools/gateway/devworkspace/DevWorkspaceWatcher.kt
  • src/main/kotlin/com/redhat/devtools/gateway/view/steps/DevSpacesServerStepView.kt
  • src/main/kotlin/com/redhat/devtools/gateway/view/steps/DevSpacesWorkspacesStepView.kt
📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of DevSpaces server and workspace updates when the IDE is busy or modal dialogs are open.
    • Ensured workspace list changes, selection updates, and controls refresh consistently on the correct UI thread.
    • Preserved updates safely when views are being disposed.

Walkthrough

The changes replace IntelliJ UI scheduling helpers with explicit EDT dispatch and ModalityState.any() handling across workspace watching, server updates, and workspace-step updates.

Changes

EDT modality scheduling

Layer / File(s) Summary
Watcher event dispatch
src/main/kotlin/com/redhat/devtools/gateway/devworkspace/DevWorkspaceWatcher.kt
Watch event processing now uses Dispatchers.EDT with ModalityState.any().asContextElement().
Server step UI updates
src/main/kotlin/com/redhat/devtools/gateway/view/steps/DevSpacesServerStepView.kt
Cluster updates now switch to the EDT with any-modality context while preserving disposal, selection, authentication-tab, and save-checkbox updates.
Workspace step UI updates
src/main/kotlin/com/redhat/devtools/gateway/view/steps/DevSpacesWorkspacesStepView.kt
Workspace list, button, tooltip, and watch-event updates now use ApplicationManager.getApplication().invokeLater with ModalityState.any().

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: adietish, azatsarynnyy

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the modal-dialog UI update issue and the use of ModalityState.any() to resolve it.
Title check ✅ Passed The title clearly identifies the modal-dialog wizard UI update fix and includes the relevant issue reference.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@codecov-commenter

codecov-commenter commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.14%. Comparing base (71098f6) to head (d2e12a6).
⚠️ Report is 414 commits behind head on main.

Files with missing lines Patch % Lines
.../gateway/view/steps/DevSpacesWorkspacesStepView.kt 0.00% 34 Missing ⚠️
...ools/gateway/view/steps/DevSpacesServerStepView.kt 0.00% 10 Missing ⚠️
...vtools/gateway/devworkspace/DevWorkspaceWatcher.kt 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            main     #358       +/-   ##
==========================================
+ Coverage   0.00%   34.14%   +34.14%     
==========================================
  Files          4      113      +109     
  Lines         26     4809     +4783     
  Branches       0      920      +920     
==========================================
+ Hits           0     1642     +1642     
- Misses        26     2931     +2905     
- Partials       0      236      +236     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/main/kotlin/com/redhat/devtools/gateway/devworkspace/DevWorkspaceWatcher.kt`:
- Line 60: Move the createFilter(namespace) call out of the
withContext(Dispatchers.EDT + ModalityState.any().asContextElement()) block in
DevWorkspaceWatcher, ensuring createIdeaEditorFilter and its blocking
getTemplateMap lookup run on a background context before the EDT UI update. Keep
only the UI mutation inside the EDT context and preserve the existing
ADDED-event behavior.

In
`@src/main/kotlin/com/redhat/devtools/gateway/view/steps/DevSpacesWorkspacesStepView.kt`:
- Around line 537-560: Update refreshDevWorkspace so the background
DevWorkspaces.get() call remains off the EDT, but dispatch all listDWDataModel
index lookups, assignments, and dependent enableButtons() calls through
ApplicationManager.getApplication().invokeLater(...). Keep the existing worker
error handling and ensure model writes cannot overlap watch callbacks or full
refresh operations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b12bdbd-0acf-4e74-a08b-31ca2d3aa819

📥 Commits

Reviewing files that changed from the base of the PR and between b6421cb and 6ca7089.

📒 Files selected for processing (3)
  • src/main/kotlin/com/redhat/devtools/gateway/devworkspace/DevWorkspaceWatcher.kt
  • src/main/kotlin/com/redhat/devtools/gateway/view/steps/DevSpacesServerStepView.kt
  • src/main/kotlin/com/redhat/devtools/gateway/view/steps/DevSpacesWorkspacesStepView.kt

@vrubezhny
vrubezhny marked this pull request as draft July 31, 2026 22:09
The server selection and workspace selection wizard pages use EDT
dispatch (invokeLater, runInEdt, withContext(Dispatchers.EDT)) to
update UI components — cluster dropdown, DevWorkspace list, button
states, and workspace status icons. These calls default to
ModalityState.nonModal(), which defers execution until the modal
dialog closes. This causes the UI to freeze when the wizard runs
as a modal dialog (File -> Remote Development -> Connect to Dev
Spaces), while working fine in non-modal mode (Run Plugin task).

Use ModalityState.any() for all EDT dispatch in the wizard steps
and the DevWorkspaceWatcher so that UI updates execute regardless
of the current modal context.

Also move the blocking createFilter(namespace) call in
DevWorkspaceWatcher out of the EDT context to avoid freezing the
UI on ADDED events, and dispatch refreshDevWorkspace model writes
to EDT to prevent races with watch callbacks.

Fixes: https://redhat.atlassian.net/browse/CRW-12139

Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>
@vrubezhny
vrubezhny force-pushed the fix/modal-wizard-edt-dispatch branch from 6ca7089 to d2e12a6 Compare July 31, 2026 22:20
@vrubezhny
vrubezhny marked this pull request as ready for review July 31, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants