Conversation
📝 WalkthroughWalkthroughThis PR migrates Vue Router navigation guards from the callback-based Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 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 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/src/views/GNewShoot.vue (1)
177-192: Missing explicitreturn trueat end ofbeforeRouteLeave.When the draft is not dirty or navigation is confirmed, the function ends without returning a value. While Vue Router 5 treats
undefinedas allowing navigation, this is inconsistent with the explicitreturn truepattern used inbeforeRouteUpdate(line 198) and other guards in this PR.♻️ Add explicit return for consistency
if (!this.isShootCreated && this.isShootDirty && !await this.confirmNavigation()) { return false } + + return true },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/src/views/GNewShoot.vue` around lines 177 - 192, The beforeRouteLeave guard (function beforeRouteLeave) can end without returning a value in some branches; update it to explicitly return true at the end so it consistently allows navigation (matching beforeRouteUpdate). Locate beforeRouteLeave and add a final "return true" after the existing checks that reference sortedInfraProviderTypeList, v$.$invalid, confirmNavigateToYamlIfInvalid(), isShootCreated, isShootDirty, and confirmNavigation() so all code paths explicitly return a boolean.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@frontend/src/views/GNewShoot.vue`:
- Around line 177-192: The beforeRouteLeave guard (function beforeRouteLeave)
can end without returning a value in some branches; update it to explicitly
return true at the end so it consistently allows navigation (matching
beforeRouteUpdate). Locate beforeRouteLeave and add a final "return true" after
the existing checks that reference sortedInfraProviderTypeList, v$.$invalid,
confirmNavigateToYamlIfInvalid(), isShootCreated, isShootDirty, and
confirmNavigation() so all code paths explicitly return a boolean.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bc3a78d1-988c-4edd-89bb-af6463d2eaee
📒 Files selected for processing (8)
frontend/src/layouts/GDefault.vuefrontend/src/layouts/GLogin.vuefrontend/src/views/GNewShoot.vuefrontend/src/views/GNewShootEditor.vuefrontend/src/views/GProjectPlaceholder.vuefrontend/src/views/GShootItemEditor.vuefrontend/src/views/GShootItemPlaceholder.vuefrontend/src/views/GShootList.vue
💤 Files with no reviewable changes (2)
- frontend/src/views/GShootItemPlaceholder.vue
- frontend/src/views/GProjectPlaceholder.vue
There was a problem hiding this comment.
🧹 Nitpick comments (4)
frontend/__tests__/components/GLogin.spec.js (4)
152-152: Same cleanup: remove unnecessaryundefinedargument.♻️ Suggested cleanup
- await GLogin.beforeRouteEnter.call(wrapper.vm, to, undefined) + await GLogin.beforeRouteEnter.call(wrapper.vm, to)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/__tests__/components/GLogin.spec.js` at line 152, The test calls GLogin.beforeRouteEnter with an unnecessary explicit undefined for the second argument; update the invocation to remove that argument so it becomes await GLogin.beforeRouteEnter.call(wrapper.vm, to), referencing the GLogin.beforeRouteEnter method and wrapper.vm/to variables in the test.
138-140: Same cleanup: remove unnecessaryundefinedargument.♻️ Suggested cleanup
- await GLogin.beforeRouteEnter.call(wrapper.vm, to, undefined) + await GLogin.beforeRouteEnter.call(wrapper.vm, to)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/__tests__/components/GLogin.spec.js` around lines 138 - 140, Remove the unnecessary undefined argument passed to the navigation guard call: update the test to call GLogin.beforeRouteEnter via .call(wrapper.vm, to) without the extra undefined; leave the mounted invocation as await GLogin.mounted.call(wrapper.vm). This targets the GLogin.beforeRouteEnter call site in the test and simply removes the spurious third parameter.
34-34: Consider removing unusedloginStorevariable.The
loginStorevariable is assigned inbeforeEachbut never used directly in the tests. Tests access store state through the component instance (wrapper.vm.loginError) instead. If there's no planned usage, the variable and its initialization at line 88 can be removed.♻️ Suggested cleanup
- let loginStore // eslint-disable-line no-unused-varsAnd in
beforeEach:- loginStore = useLoginStore() + useLoginStore() // Initialize store for testsOr remove the line entirely if initialization happens implicitly through the component.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/__tests__/components/GLogin.spec.js` at line 34, Remove the unused test-scoped variable loginStore: delete the declaration "let loginStore" and its assignment in the beforeEach setup (where loginStore is set), and keep tests using the component instance and wrapper.vm (e.g., wrapper.vm.loginError) as the source of store/state; ensure no other references to loginStore remain.
116-119: Remove unnecessaryundefinedargument for consistency with new guard signature.The
beforeRouteEnterfunction now only takes(to)as its parameter. Passingundefinedas a second argument is a remnant of the old(to, from, next)pattern and can be removed for clarity.♻️ Suggested cleanup
- await GLogin.beforeRouteEnter.call(wrapper.vm, to, undefined) + await GLogin.beforeRouteEnter.call(wrapper.vm, to)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/__tests__/components/GLogin.spec.js` around lines 116 - 119, The test calls GLogin.beforeRouteEnter with an extra undefined second argument from the old (to, from, next) signature; update the call to match the new single-parameter guard by removing the extraneous argument — change the invocation of GLogin.beforeRouteEnter.call(wrapper.vm, to, undefined) to GLogin.beforeRouteEnter.call(wrapper.vm, to) and keep the subsequent GLogin.mounted.call(wrapper.vm) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@frontend/__tests__/components/GLogin.spec.js`:
- Line 152: The test calls GLogin.beforeRouteEnter with an unnecessary explicit
undefined for the second argument; update the invocation to remove that argument
so it becomes await GLogin.beforeRouteEnter.call(wrapper.vm, to), referencing
the GLogin.beforeRouteEnter method and wrapper.vm/to variables in the test.
- Around line 138-140: Remove the unnecessary undefined argument passed to the
navigation guard call: update the test to call GLogin.beforeRouteEnter via
.call(wrapper.vm, to) without the extra undefined; leave the mounted invocation
as await GLogin.mounted.call(wrapper.vm). This targets the
GLogin.beforeRouteEnter call site in the test and simply removes the spurious
third parameter.
- Line 34: Remove the unused test-scoped variable loginStore: delete the
declaration "let loginStore" and its assignment in the beforeEach setup (where
loginStore is set), and keep tests using the component instance and wrapper.vm
(e.g., wrapper.vm.loginError) as the source of store/state; ensure no other
references to loginStore remain.
- Around line 116-119: The test calls GLogin.beforeRouteEnter with an extra
undefined second argument from the old (to, from, next) signature; update the
call to match the new single-parameter guard by removing the extraneous argument
— change the invocation of GLogin.beforeRouteEnter.call(wrapper.vm, to,
undefined) to GLogin.beforeRouteEnter.call(wrapper.vm, to) and keep the
subsequent GLogin.mounted.call(wrapper.vm) unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b7024180-94ca-4ad1-87ff-cf0b75498492
📒 Files selected for processing (1)
frontend/__tests__/components/GLogin.spec.js
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note:
Summary by CodeRabbit
Refactor
Tests