|
30 | 30 |
|
31 | 31 | ### BREAKING CHANGES
|
32 | 32 |
|
33 |
| -* **runtime-core:** replae `watch(fn, options?)` with `watchEffect` |
| 33 | +* **runtime-core:** replace `watch(fn, options?)` with `watchEffect` |
34 | 34 |
|
35 | 35 | The `watch(fn, options?)` signature has been replaced by the new
|
36 | 36 | `watchEffect` API, which has the same usage and behavior. `watch`
|
37 |
| - now only supports the `watch(source, cb, options?)` signautre. |
38 |
| -* reactive arrays no longer unwraps contained refs |
| 37 | + now only supports the `watch(source, cb, options?)` signature. |
| 38 | + |
| 39 | +* **reactivity:** reactive arrays no longer unwraps contained refs |
39 | 40 |
|
40 | 41 | When reactive arrays contain refs, especially a mix of refs and
|
41 | 42 | plain values, Array prototype methods will fail to function
|
42 | 43 | properly - e.g. sort() or reverse() will overwrite the ref's value
|
| 44 | + instead of moving it (see #737). |
| 45 | + |
| 46 | + Ensuring correct behavior for all possible Array methods while |
| 47 | + retaining the ref unwrapping behavior is exceedinly complicated; In |
| 48 | + addition, even if Vue handles the built-in methods internally, it |
| 49 | + would still break when the user attempts to use a 3rd party utility |
| 50 | + functioon (e.g. lodash) on a reactive array containing refs. |
| 51 | + |
| 52 | + After this commit, similar to other collection types like Map and |
| 53 | + Set, Arrays will no longer automatically unwrap contained refs. |
| 54 | + |
| 55 | + The usage of mixed refs and plain values in Arrays should be rare in |
| 56 | + practice. In cases where this is necessary, the user can create a |
| 57 | + computed property that performs the unwrapping. |
43 | 58 |
|
44 | 59 |
|
45 | 60 |
|
|
0 commit comments