Skip to content

Conversation

Vcc1
Copy link

@Vcc1 Vcc1 commented Sep 5, 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

  • New Features

    • Improved handling of asynchronous route components for smoother navigation.
    • Enhanced loading behavior during page changes, providing more reliable placeholders while content loads.
  • Refactor

    • Reorganized view rendering to ensure consistent behavior with or without transitions, improving stability without altering user-facing APIs.

Copy link

changeset-bot bot commented Sep 5, 2025

⚠️ No Changeset found

Latest commit: 8630db5

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 5, 2025

Walkthrough

Refactors route content rendering to split the Transition-enabled and non-transition paths into two separate Suspense branches. Each branch wraps the same KeepAlive/Component logic, preserving transformComponent and keying behavior. The previous single Transition with an else template is removed to support Suspense for async route components.

Changes

Cohort / File(s) Summary
Layout content rendering
packages/effects/layouts/src/basic/content/content.vue
Replaced single Transition-gated RouterView with two Suspense branches (v-if getEnabledTransition / v-else). Each branch contains the same KeepAlive/Component rendering and transformComponent logic; old else template removed. Control flow updated to support async components via Suspense.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Route as Router
    participant View as Content.vue
    participant SuspT as Suspense (Transition)
    participant Trans as Transition
    participant Susp as Suspense (No Transition)
    participant KA as KeepAlive
    participant Comp as Component

    Route->>View: Route update with Component, route
    alt getEnabledTransition == true
        View->>SuspT: Render async branch
        SuspT->>Trans: Wrap Transition
        Trans->>KA: Conditionally wrap Comp (keepAlive)
        KA->>Comp: render transformComponent(Component, route)
        note right of Comp: Key = getTabKey(route)
    else
        View->>Susp: Render async branch (no Transition)
        Susp->>KA: Conditionally wrap Comp (keepAlive)
        KA->>Comp: render transformComponent(Component, route)
        note right of Comp: Key = getTabKey(route)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • mynetfan
  • anncwb
  • jinmao88
  • vince292007

Poem

I hop between routes, light on my feet,
Two cozy Suspense burrows where async can meet.
If transitions beckon, I twirl with delight—
Else I nestle, still, in a no-fuss night.
Keys on my whiskers, cache in my keep,
Rendering dreams where components sleep. 🐇✨

✨ 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 1

🧹 Nitpick comments (1)
packages/effects/layouts/src/basic/content/content.vue (1)

103-131: Reduce duplication: single Suspense + dynamic Transition; preserve cache on preference toggle

Two Suspense branches duplicate logic and remount the subtree when toggling transitions, potentially dropping KeepAlive cache. Use one Suspense and keep Transition always present with a conditional name.

@@
-      <Suspense   v-if="getEnabledTransition">
-         <Transition
-         
-           :name="getTransitionName(route)"
-           appear
-           mode="out-in"
-         >
+      <Suspense>
+        <Transition
+          :name="getEnabledTransition ? getTransitionName(route) : undefined"
+          appear
+          mode="out-in"
+        >
@@
-          </Transition>
-      </Suspense>
-      <Suspense v-else>
-        <KeepAlive
-          v-if="keepAlive"
-          :exclude="getExcludeCachedTabs"
-          :include="getCachedTabs"
-        >
-          <component
-            :is="transformComponent(Component, route)"
-            v-if="renderRouteView"
-            v-show="!route.meta.iframeSrc"
-            :key="getTabKey(route)"
-          />
-        </KeepAlive>
-        <component
-          :is="Component"
-          v-else-if="renderRouteView"
-          :key="getTabKey(route)"
-        />
-      </Suspense>
+        </Transition>
+        <!-- Optional: show a lightweight loader while async components resolve -->
+        <!--
+        <template #fallback>
+          <div class="p-4 text-secondary text-sm">Loading…</div>
+        </template>
+        -->
+      </Suspense>

Also applies to: 132-149

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6a85b3a and 8630db5.

📒 Files selected for processing (1)
  • packages/effects/layouts/src/basic/content/content.vue (2 hunks)
⏰ 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 (ubuntu-latest)
  • GitHub Check: post-update (windows-latest)

Comment on lines +124 to +127
:is="Component"
v-else-if="renderRouteView"
:key="getTabKey(route)"
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix: iframe routes render twice when keepAlive is false

The non-keepAlive branch doesn’t hide the component for iframe routes, so both IFrameRouterView and the route component can render. Mirror the v-show guard used inside KeepAlive.

@@
-                <component
-                  :is="Component"
-                  v-else-if="renderRouteView"
-                  :key="getTabKey(route)"
-                />
+                <component
+                  :is="Component"
+                  v-else-if="renderRouteView"
+                  v-show="!route.meta.iframeSrc"
+                  :key="getTabKey(route)"
+                />
@@
-        <component
-          :is="Component"
-          v-else-if="renderRouteView"
-          :key="getTabKey(route)"
-        />
+        <component
+          :is="Component"
+          v-else-if="renderRouteView"
+          v-show="!route.meta.iframeSrc"
+          :key="getTabKey(route)"
+        />

Also applies to: 145-148

🤖 Prompt for AI Agents
In packages/effects/layouts/src/basic/content/content.vue around lines 124-127
(and similarly 145-148), the non-keepAlive branch renders the route component
unconditionally which allows iframe routes to render twice; add the same v-show
guard used inside the KeepAlive branch to the v-else-if branch so the component
is hidden when the current route is an iframe (mirror the v-show condition from
the KeepAlive branch) to prevent double rendering.

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