Skip to content

Conversation

yangdan8
Copy link
Contributor

@yangdan8 yangdan8 commented Aug 15, 2025

…alue presence

Summary by CodeRabbit

  • Bug Fixes
    • Fixed iteration behavior so falsy values (0, '', false) are now correctly handled during iteration, preserving reactivity updates.
    • Ensures consistent wrapping of non-final iteration results, improving stability in templates, computed values, and watchers; no public API changes.

Copy link

coderabbitai bot commented Aug 15, 2025

Walkthrough

Iterator wrapper in arrayInstrumentations now applies wrapValue whenever an iterator result is not done (i.e., checks !result.done), ensuring falsy values are wrapped; wrapping is skipped only for done: true. No public API or exported signatures changed.

Changes

Cohort / File(s) Change Summary
Iterator wrapping logic
packages/reactivity/src/arrayInstrumentations.ts
Replaced condition if (result.value) with if (!result.done) so wrapValue is invoked for all non-final iterator results (including falsy values); no wrapping when done is true. No public API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant ReactiveArray
  participant Iterator
  participant wrapValue

  User->>ReactiveArray: for...of / iteration
  ReactiveArray->>Iterator: next()
  loop while not done
    Iterator-->>ReactiveArray: { value, done: false }
    Note over ReactiveArray,wrapValue: New behavior: wrap even falsy values\n(condition: !result.done)
    ReactiveArray->>wrapValue: wrap(value)
    wrapValue-->>ReactiveArray: wrappedValue
    ReactiveArray-->>User: wrappedValue
    ReactiveArray->>Iterator: next()
  end
  Iterator-->>ReactiveArray: { value, done: true }
  ReactiveArray-->>User: iteration ends (no wrapping)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately summarizes the main change—switching the iterator check from inspecting the value to checking completion (done)—and uses the conventional-commit prefix (fix(reactivity):), making it clear and relevant to the changes in packages/reactivity/src/arrayInstrumentations.ts.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Poem

I hop through loops with careful care,
Wrapping each nibble of value there—
Falsy or shiny, none are spared a coat,
Until “done” calls time and ends the note.
Carrot-debugged, I bound with glee.

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.

Please see the documentation for more information.

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 8354e25 and 6b7468a.

📒 Files selected for processing (1)
  • packages/reactivity/src/arrayInstrumentations.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/reactivity/src/arrayInstrumentations.ts
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 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.

@edison1105
Copy link
Member

Could you please add a test case?

Copy link

github-actions bot commented Aug 25, 2025

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB (-1 B) 38.5 kB (-1 B) 34.6 kB (-2 B)
vue.global.prod.js 159 kB (-1 B) 58.6 kB (+1 B) 52.2 kB (+70 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.6 kB (-1 B) 18.2 kB (+1 B) 16.7 kB (-11 B)
createApp 54.6 kB (-1 B) 21.3 kB (+1 B) 19.5 kB (+13 B)
createSSRApp 58.9 kB (-1 B) 23 kB 21 kB
defineCustomElement 59.6 kB (-1 B) 22.8 kB (+1 B) 20.9 kB (+5 B)
overall 68.8 kB (-1 B) 26.4 kB (-1 B) 24.1 kB (-66 B)

Copy link

pkg-pr-new bot commented Aug 25, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13761

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13761

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13761

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13761

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13761

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13761

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13761

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13761

@vue/shared

npm i https://pkg.pr.new/@vue/shared@13761

vue

npm i https://pkg.pr.new/vue@13761

@vue/compat

npm i https://pkg.pr.new/@vue/compat@13761

commit: 6b7468a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants