Repository navigation
fix(hydration): keep lazy hydration on the async wrapper path - #14704
Conversation
…top owning the main view
…ned close markers
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/compiler-vapor
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/runtime-vapor
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
Size ReportBundles
Usages
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/runtime-vapor/__tests__/hydration.spec.ts (1)
5172-5631: Avoid fixed wall-clock sleeps in the new Suspense/async hydration tests.The
setTimeout(10)/setTimeout(20)pairing makes these assertions scheduler-sensitive in CI. Prefer a manually controlled deferred promise or fake timers so each test advances exactly when the async boundary resolves.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/runtime-vapor/__tests__/hydration.spec.ts` around lines 5172 - 5631, Tests use real setTimeout-based sleeps (new Promise(r => setTimeout(r, 10/20))) in the Vapor tests (see vaporChildCode async setup, and the test waits after app.mount in 'hydrate VDOM Suspense vapor async setup updates empty v-for before trailing sibling' and similar tests). Replace these hard sleeps with a controllable async helper: either use fake timers (vi.useFakeTimers / vi.advanceTimersByTime) around the test or inject/return a Deferred promise from the async setup and explicitly resolve it in the test before awaiting nextTick so the async boundary deterministically proceeds; update all occurrences of new Promise(r => setTimeout(r, ...)) and subsequent await new Promise(r => setTimeout(r, ...)) in the tests and ensure mount/wait logic (app.mount + await nextTick) awaits the controlled resolution instead of wall-clock delays.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/runtime-vapor/__tests__/hydration.spec.ts`:
- Around line 5172-5631: Tests use real setTimeout-based sleeps (new Promise(r
=> setTimeout(r, 10/20))) in the Vapor tests (see vaporChildCode async setup,
and the test waits after app.mount in 'hydrate VDOM Suspense vapor async setup
updates empty v-for before trailing sibling' and similar tests). Replace these
hard sleeps with a controllable async helper: either use fake timers
(vi.useFakeTimers / vi.advanceTimersByTime) around the test or inject/return a
Deferred promise from the async setup and explicitly resolve it in the test
before awaiting nextTick so the async boundary deterministically proceeds;
update all occurrences of new Promise(r => setTimeout(r, ...)) and subsequent
await new Promise(r => setTimeout(r, ...)) in the tests and ensure mount/wait
logic (app.mount + await nextTick) awaits the controlled resolution instead of
wall-clock delays.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 09388716-7ad1-4f1d-8a0a-8f7feedf26cd
📒 Files selected for processing (9)
packages/runtime-vapor/__tests__/hydration.spec.tspackages/runtime-vapor/src/apiCreateFor.tspackages/runtime-vapor/src/apiDefineAsyncComponent.tspackages/runtime-vapor/src/component.tspackages/runtime-vapor/src/components/Teleport.tspackages/runtime-vapor/src/dom/hydration.tspackages/runtime-vapor/src/dom/prop.tspackages/runtime-vapor/src/fragment.tspackages/vue/__tests__/e2e/hydrationStrategies.spec.ts
63eeec1 to
e8557fc
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/runtime-vapor/src/component.ts (1)
850-857: Consider consolidating anchor reusability check logic.The
isReusableNullComponentAnchorfunction is similar toisReusableDynamicFragmentAnchorinfragment.ts(lines 535-546), but with different semantics:
- This version: unconditionally accepts any of the 4 anchor types
- Fragment version: matches exact label OR allows empty comment for specific labels
While functionally correct, you may want to consider either:
- Extracting shared logic to
dom/hydration.ts- Adding a comment explaining why separate implementations are needed
This is a minor maintainability suggestion and not blocking.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/runtime-vapor/src/component.ts` around lines 850 - 857, The two functions isReusableNullComponentAnchor and isReusableDynamicFragmentAnchor share similar anchor-check logic; either extract the common matching behavior into a shared helper in dom/hydration.ts (e.g., a function like matchesAnchor(node, allowedLabels, allowEmptyOnlyForLabels)) and update both isReusableNullComponentAnchor and isReusableDynamicFragmentAnchor to call that helper, or add a concise comment above isReusableNullComponentAnchor explaining why its semantics must unconditionally accept empty/comment labels (contrasting fragment behavior) so future maintainers understand the divergence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/runtime-vapor/src/component.ts`:
- Around line 850-857: The two functions isReusableNullComponentAnchor and
isReusableDynamicFragmentAnchor share similar anchor-check logic; either extract
the common matching behavior into a shared helper in dom/hydration.ts (e.g., a
function like matchesAnchor(node, allowedLabels, allowEmptyOnlyForLabels)) and
update both isReusableNullComponentAnchor and isReusableDynamicFragmentAnchor to
call that helper, or add a concise comment above isReusableNullComponentAnchor
explaining why its semantics must unconditionally accept empty/comment labels
(contrasting fragment behavior) so future maintainers understand the divergence.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3541a6b0-fb8c-4e10-a619-33aaf7bb6f3a
📒 Files selected for processing (3)
packages/runtime-vapor/__tests__/hydration.spec.tspackages/runtime-vapor/src/component.tspackages/runtime-vapor/src/fragment.ts
Summary by CodeRabbit
Bug Fixes
Tests