fix(reactivity): correctly wrap iterated array items to preserve their readonly status#14120
fix(reactivity): correctly wrap iterated array items to preserve their readonly status#14120edison1105 merged 1 commit intomainfrom
Conversation
…r readonly status
WalkthroughFixed a bug where deep readonly semantics were not preserved when iterating over readonly ref-wrapped arrays. Introduced a new Changes
Sequence DiagramsequenceDiagram
participant Code as Calling Code
participant Method as Array Method<br/>(e.g., forEach, map)
participant toWrapped as toWrapped Helper
participant Target as Target Proxy State
Code->>Method: Invoke iteration method on readonly array
Method->>toWrapped: For each element, determine wrapping
toWrapped->>Target: Check: isReactive? isReadonly?<br/>isShallow?
Target-->>toWrapped: Target state flags
alt Readonly target
toWrapped-->>Method: Apply toReadonly
else Reactive (non-shallow) target
toWrapped-->>Method: Apply toReactive
else Shallow or other
toWrapped-->>Method: Return unwrapped value
end
Method-->>Code: Return element with correct wrapper
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-11-05T14:53:01.052ZApplied to files:
🧬 Code graph analysis (2)packages/reactivity/src/arrayInstrumentations.ts (1)
packages/reactivity/__tests__/readonly.spec.ts (3)
⏰ 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). (3)
🔇 Additional comments (6)
Comment |
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
|
How can I interpret the failures from the ecosystem CI step? And what does this mean for us developers and end users? |
close #14119
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.