added compat actions to navigation controller#150
Conversation
📝 WalkthroughWalkthroughNavigationController now implements 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
e15df9e to
8ce151e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@framework/ui/internal/navigationcontroller.cpp`:
- Around line 325-329: Set the dispatcher immediately after obtaining it in the
NavigationController initialization flow, before manually registering actions,
so Actionable can unregister them during destruction. Specifically update
framework/ui/internal/navigationcontroller.cpp lines 325-329 around
actionsDispatcher() and reg(); framework/ui/internal/navigationcontroller.h
lines 41-45 only documents the Actionable inheritance and requires no direct
change.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: cfb98277-f314-4e2b-b6ac-91cc0620a6d6
📒 Files selected for processing (5)
framework/ui/internal/navigationcontroller.cppframework/ui/internal/navigationcontroller.hframework/ui/tests/CMakeLists.txtframework/ui/tests/environment.cppframework/ui/tests/navigationcontroller_tests.cpp
| auto ad = actionsDispatcher(); | ||
| for (const auto& [action, command] : compatActionToCommand) { | ||
| ad->reg(this, action, [d, command]() { d->dispatch(command); }); | ||
| } | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Ensure Actionable::setDispatcher is called to guarantee cleanup.
The NavigationController inherits from actions::Actionable, which relies on its m_dispatcher member to automatically unregister actions in ~Actionable(). Since you are manually registering actions with ad->reg(...), you need to explicitly set the dispatcher so the base class can properly clean up these registrations when the controller is destroyed.
framework/ui/internal/navigationcontroller.cpp#L325-L329: CallsetDispatcher(ad);right after retrieving the dispatcher to ensure the base class has the pointer for cleanup.framework/ui/internal/navigationcontroller.h#L41-L45:NavigationControllerinheritsactions::Actionablehere, inherently taking on this lifecycle requirement.
🛠️ Proposed fix
auto ad = actionsDispatcher();
+ setDispatcher(ad);
for (const auto& [action, command] : compatActionToCommand) {
ad->reg(this, action, [d, command]() { d->dispatch(command); });
}📝 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.
| auto ad = actionsDispatcher(); | |
| for (const auto& [action, command] : compatActionToCommand) { | |
| ad->reg(this, action, [d, command]() { d->dispatch(command); }); | |
| } | |
| } | |
| auto ad = actionsDispatcher(); | |
| setDispatcher(ad); | |
| for (const auto& [action, command] : compatActionToCommand) { | |
| ad->reg(this, action, [d, command]() { d->dispatch(command); }); | |
| } | |
| } |
🧰 Tools
🪛 Clang (14.0.6)
[warning] 325-325: variable name 'ad' is too short, expected at least 3 characters
(readability-identifier-length)
📍 Affects 2 files
framework/ui/internal/navigationcontroller.cpp#L325-L329(this comment)framework/ui/internal/navigationcontroller.h#L41-L45
🤖 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 `@framework/ui/internal/navigationcontroller.cpp` around lines 325 - 329, Set
the dispatcher immediately after obtaining it in the NavigationController
initialization flow, before manually registering actions, so Actionable can
unregister them during destruction. Specifically update
framework/ui/internal/navigationcontroller.cpp lines 325-329 around
actionsDispatcher() and reg(); framework/ui/internal/navigationcontroller.h
lines 41-45 only documents the Actionable inheritance and requires no direct
change.
No description provided.