Skip to content

Conversation

Lynnettee-web
Copy link

@Lynnettee-web Lynnettee-web commented Sep 9, 2025

Description

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs:dev command.
  • Run the tests with pnpm test.
  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • Bug Fixes
    • Views now fully refresh when the URL path or query changes, preventing stale or retained state between navigations.
    • Ensures consistent component lifecycle and UI state reset on route changes across Ant Design, Element and Naive web variants.
    • Improves reliability of data reloading and avoids unexpected component reuse when navigating.

Copy link

changeset-bot bot commented Sep 9, 2025

⚠️ No Changeset found

Latest commit: 92147c4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Sep 9, 2025

Walkthrough

Adds a dynamic key binding :key="$route.fullPath" to <RouterView> in three app.vue files so the routed component subtree remounts whenever the route's fullPath (path + query) changes. No script logic or public API signatures were modified.

Changes

Cohort / File(s) Summary
RouterView keyed by $route.fullPath
apps/web-antd/src/app.vue, apps/web-ele/src/app.vue, apps/web-naive/src/app.vue
Add :key="$route.fullPath" to <RouterView> so routed components unmount/remount on route fullPath changes; in web-ele the previous unkeyed <RouterView> was commented out. No script or API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Router as Vue Router
  participant App as App.vue
  participant RV as RouterView (key=$route.fullPath)
  participant Page as Routed Component

  User->>Router: navigate to /path?query=...
  Router-->>App: update $route (fullPath)
  App->>RV: render with new :key
  note over RV: key changed → triggers remount
  RV--x Page: unmount previous instance
  RV->>Page: mount new instance
  Page-->>User: fresh lifecycle & state
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • mynetfan
  • anncwb
  • jinmao88
  • vince292007

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description currently only includes unfilled template placeholders with no actual change details, missing a description of the modifications, issue references, selected type of change, and an updated checklist, so it does not meet the repository’s description requirements. Please complete the Description section by summarizing the RouterView key-binding change and its bug fix context, link the related issue, mark the appropriate Type of change, and check off all relevant items in the checklist including tests, documentation, and changelog updates.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the primary change by indicating a fix for blank pages appearing during route navigation, directly reflecting the adjustments to the RouterView behavior without extraneous detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I hopped through routes, hop-hop, anew,
Each path a burrow, fresh with dew.
With keys that spin on fullPath’s cue,
Old nests vanish—hello, new view!
Thump-thump—reset, remount, yahoo! 🥕🐇

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e9a46b and 92147c4.

📒 Files selected for processing (1)
  • apps/web-ele/src/app.vue (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web-ele/src/app.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: post-update (windows-latest)
  • GitHub Check: post-update (ubuntu-latest)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
apps/web-antd/src/app.vue (1)

36-36: Consider KeepAlive cache growth with fullPath keys

Keying the root RouterView by $route.fullPath (apps/web-antd/src/app.vue:36) forces remount on any path/query/hash change, but since this RouterView is wrapped in <KeepAlive> in packages/effects/layouts/src/basic/content/content.vue (lines 109–112, 128–131), each unique fullPath yields a separate cached instance, risking unbounded memory growth if queries vary. If acceptable, merge as is; otherwise, use a stable computed key (e.g. based on route.path or route.name) via useRoute() + computed to limit remounts.

apps/web-naive/src/app.vue (1)

52-52: Validate remount behavior and optionally introduce computed viewKey
No <keep-alive> wrappers exist in the apps directory, so this change will always remount on query/hash changes—confirm this is acceptable for your routing flows. Optionally refactor to:

<script lang="ts" setup>
 import { computed } from 'vue';
+import { useRoute } from 'vue-router';

 const route = useRoute();
 const viewKey = computed(() => route.fullPath);
</script>

-<RouterView :key="$route.fullPath" />
+<RouterView :key="viewKey" />
apps/web-ele/src/app.vue (2)

15-16: Remove dead commented RouterView

The commented adds noise. Please delete it.

-    <!-- <RouterView /> -->
     <RouterView :key="$route.fullPath" />

16-16: Confirm fullPath keying won’t inflate KeepAlive cache or hurt perf

Same considerations as other apps: guaranteed remount vs. potential cache growth and perf cost on query/hash changes. If needed, switch to a centralized computed key to tune behavior later:

 <script lang="ts" setup>
+import { computed } from 'vue';
+import { useRoute } from 'vue-router';
@@
+const route = useRoute();
+const viewKey = computed(() => route.fullPath);
 </script>
@@
-    <RouterView :key="$route.fullPath" />
+    <RouterView :key="viewKey" />

Regression checklist to run locally:

  • Navigate between same-path different-query routes repeatedly; watch memory and component instance counts in Vue devtools.
  • Toggle hash within a route; ensure remount is intentional.
  • Test tab caching, tab close/restore, and “Open in new window” (learned to prefer fullPath for navigation).
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a85b3a and 7e9a46b.

📒 Files selected for processing (3)
  • apps/web-antd/src/app.vue (1 hunks)
  • apps/web-ele/src/app.vue (1 hunks)
  • apps/web-naive/src/app.vue (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: dingdayu
PR: vbenjs/vue-vben-admin#5500
File: packages/stores/src/modules/tabbar.ts:557-559
Timestamp: 2025-02-08T07:05:28.825Z
Learning: In Vue Vben Admin, while tab identification uses `path` to group tabs with same path but different queries, router navigation operations (router.push) and new window operations should use `fullPath` to preserve the complete URL including query parameters. This applies specifically to:
1. Router navigation in tab maximize/restore feature
2. Opening tabs in new window via openTabInNewWindow
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: post-update (windows-latest)
  • GitHub Check: post-update (ubuntu-latest)

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.

1 participant