Usability: Render IDE Preferences only once the saved IDE has loaded#13133
Usability: Render IDE Preferences only once the saved IDE has loaded#13133az108 wants to merge 1 commit into
Usability: Render IDE Preferences only once the saved IDE has loaded#13133Conversation
The IDE Preferences page seeded a VS Code default and loaded the predefined IDEs and saved preferences asynchronously, so when the saved IDE was not VS Code the selection first showed VS Code and then jumped. Load both in parallel and gate the IDE button rows behind a loading state so the correct selection renders from the start. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
WalkthroughIdeSettingsComponent now tracks an ChangesIDE Preferences Loading State
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/webapp/app/account/user/settings/ide-preferences/ide-settings.component.spec.ts (1)
68-69: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding a failure-path test.
No test verifies
isLoadingresets tofalse(via thefinallyblock) when either load rejects. Given the missingcatchin the component, such a test would surface the unhandled-rejection behavior directly.🤖 Prompt for 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. In `@src/main/webapp/app/account/user/settings/ide-preferences/ide-settings.component.spec.ts` around lines 68 - 69, Add a failure-path spec for the IDE settings component that verifies ide preferences loading clears isLoading back to false when either async load rejects. Use the existing ide-settings.component.spec.ts setup and the component’s isLoading state, and exercise the load path so the finally behavior is covered even without a catch, surfacing the rejection handling issue directly.
🤖 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/webapp/app/account/user/settings/ide-preferences/ide-settings.component.ts`:
- Around line 60-62: The ProgrammingLanguage.EMPTY fallback in
ide-settings.component.ts can be seeded with undefined when predefinedIdes is
empty. Update the initialization around programmingLanguageToIdeMap and
ProgrammingLanguage.EMPTY to first check that predefinedIdes has at least one
entry before calling set, and otherwise skip the fallback or handle the empty
state explicitly.
---
Nitpick comments:
In
`@src/main/webapp/app/account/user/settings/ide-preferences/ide-settings.component.spec.ts`:
- Around line 68-69: Add a failure-path spec for the IDE settings component that
verifies ide preferences loading clears isLoading back to false when either
async load rejects. Use the existing ide-settings.component.spec.ts setup and
the component’s isLoading state, and exercise the load path so the finally
behavior is covered even without a catch, surfacing the rejection handling issue
directly.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 986bcdc4-56a9-4742-b6e7-4ed0348858eb
📒 Files selected for processing (3)
src/main/webapp/app/account/user/settings/ide-preferences/ide-settings.component.htmlsrc/main/webapp/app/account/user/settings/ide-preferences/ide-settings.component.spec.tssrc/main/webapp/app/account/user/settings/ide-preferences/ide-settings.component.ts
| if (!programmingLanguageToIdeMap.has(ProgrammingLanguage.EMPTY)) { | ||
| programmingLanguageToIdeMap.set(ProgrammingLanguage.EMPTY, this.PREDEFINED_IDE()[0]); | ||
| programmingLanguageToIdeMap.set(ProgrammingLanguage.EMPTY, predefinedIdes[0]); | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Guard against an empty predefinedIdes array.
If the backend ever returns an empty list, predefinedIdes[0] is undefined, silently seeding ProgrammingLanguage.EMPTY with an invalid IDE entry.
🛡️ Proposed guard
- if (!programmingLanguageToIdeMap.has(ProgrammingLanguage.EMPTY)) {
+ if (!programmingLanguageToIdeMap.has(ProgrammingLanguage.EMPTY) && predefinedIdes.length > 0) {
programmingLanguageToIdeMap.set(ProgrammingLanguage.EMPTY, predefinedIdes[0]);
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (!programmingLanguageToIdeMap.has(ProgrammingLanguage.EMPTY)) { | |
| programmingLanguageToIdeMap.set(ProgrammingLanguage.EMPTY, this.PREDEFINED_IDE()[0]); | |
| programmingLanguageToIdeMap.set(ProgrammingLanguage.EMPTY, predefinedIdes[0]); | |
| } | |
| if (!programmingLanguageToIdeMap.has(ProgrammingLanguage.EMPTY) && predefinedIdes.length > 0) { | |
| programmingLanguageToIdeMap.set(ProgrammingLanguage.EMPTY, predefinedIdes[0]); | |
| } |
🤖 Prompt for 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.
In
`@src/main/webapp/app/account/user/settings/ide-preferences/ide-settings.component.ts`
around lines 60 - 62, The ProgrammingLanguage.EMPTY fallback in
ide-settings.component.ts can be seeded with undefined when predefinedIdes is
empty. Update the initialization around programmingLanguageToIdeMap and
ProgrammingLanguage.EMPTY to first check that predefinedIdes has at least one
entry before calling set, and otherwise skip the fallback or handle the empty
state explicitly.
End-to-End Test Results
❌ Failed Tests (Phase 1)
Flakiness Scores for Failed Tests
Test Strategy: Two-phase execution
Overall: ❌ E2E tests failed |
Summary
When opening Settings → IDE Preferences, the selected-IDE highlight briefly appeared on VS Code and then jumped to the actually saved IDE once the data finished loading (only noticeable when the saved IDE was not VS Code). The component seeded a hardcoded VS Code default and loaded the predefined IDE list and the saved preferences asynchronously, so the wrong selection was rendered until those loads completed. This PR waits for both loads and only then renders the IDE button rows, so the correct selection is shown from the start.
Checklist
General
Client
Motivation and Context
Closes #13127.
Rendering a placeholder selection and then jumping to the real one looks like a glitch and is briefly misleading about which IDE is configured.
Description
IdeSettingsComponent.ngOnInitnow loads the predefined IDEs (loadPredefinedIdes) and the saved preferences (loadIdePreferences) together viaPromise.all, then sets all state at once and finally clears anisLoadingflag. Previously these were two independent async paths that updated the view separately.isLoading()istrueand only renders the IDE button rows afterwards, so the correct selection is displayed from the first paint (no VS Code flash / jump).await ngOnInit()and assertisLoadingtransitionstrue → false.Steps for Testing
Prerequisites:
Screenshots
To be added.
Summary by CodeRabbit
New Features
Bug Fixes