Fix navigation to code diff and diagram diff when visualizer panel is already active#2159
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe changes add webview reveal calls in two opening paths and update review navigation to check visibility before deciding whether to navigate directly or reopen the review mode. ChangesVisualizer Focus Management
Sequence DiagramsequenceDiagram
actor User
participant ApprovalViewManager
participant StateMachine
participant StateMachinePopup
participant VisualizerWebview
User->>ApprovalViewManager: navigateReviewMode(index)
alt ReviewMode visible
ApprovalViewManager->>StateMachine: navigateReviewIndex(index)
else ReviewMode not visible
ApprovalViewManager->>StateMachine: reopen ReviewMode with cachedReviewData
ApprovalViewManager->>StateMachine: reviewModeOpened(currentIndex)
end
User->>StateMachine: openView(type, viewLocation)
StateMachine->>VisualizerWebview: reveal()
StateMachine->>StateMachine: send state event
User->>StateMachinePopup: openPopupView(EVENT_TYPE.OPEN_VIEW, ...)
StateMachinePopup->>VisualizerWebview: reveal()
StateMachinePopup->>StateMachinePopup: send popup event
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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.
🧹 Nitpick comments (1)
workspaces/ballerina/ballerina-extension/src/stateMachine.ts (1)
887-888: 💤 Low valueRedundant
reveal()inopenWebViewservice can now be removed
VisualizerWebview.currentPanel?.getWebview()?.reveal()at line 887 is the intended early reveal. However, theopenWebViewservice at line 569 also callsreveal()whencurrentPanelalready exists, so the panel ends up being revealed twice on everyopenViewcall where the panel is already open. Both calls are harmless (idempotent), but the one insideopenWebViewis now redundant given this earlier unconditional call.♻️ Optional cleanup: remove the second reveal from `openWebView`
} else { - VisualizerWebview.currentPanel!.getWebview()?.reveal(); resolve(true); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@workspaces/ballerina/ballerina-extension/src/stateMachine.ts` around lines 887 - 888, Remove the redundant reveal call inside the openWebView flow: since VisualizerWebview.currentPanel?.getWebview()?.reveal() is already invoked unconditionally before calling stateService.send, delete the additional .reveal() that openWebView performs when VisualizerWebview.currentPanel exists (refer to VisualizerWebview.currentPanel, getWebview, reveal and the openWebView service) so the panel is only revealed once on openView calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@workspaces/ballerina/ballerina-extension/src/stateMachine.ts`:
- Around line 887-888: Remove the redundant reveal call inside the openWebView
flow: since VisualizerWebview.currentPanel?.getWebview()?.reveal() is already
invoked unconditionally before calling stateService.send, delete the additional
.reveal() that openWebView performs when VisualizerWebview.currentPanel exists
(refer to VisualizerWebview.currentPanel, getWebview, reveal and the openWebView
service) so the panel is only revealed once on openView calls.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b197e387-94fa-449f-9bbd-e58948c093ec
📒 Files selected for processing (3)
workspaces/ballerina/ballerina-extension/src/features/ai/state/ApprovalViewManager.tsworkspaces/ballerina/ballerina-extension/src/stateMachine.tsworkspaces/ballerina/ballerina-extension/src/stateMachinePopup.ts
2248fa6 to
c8c9bdd
Compare
Description
It resolves: wso2/product-integrator#1375
Goals
Approach
UI Component Development
npm run storybookfrom the root directory to view current components.Manage Icons
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning
Summary by CodeRabbit