Commit Graph

42 Commits

Author SHA1 Message Date
Özer 8c7dcea619
Merge 853e9332e6 into 56be3dd4db 2025-05-05 20:38:29 +00:00
Sunny 604d08760e
test(reactivity): add tests for reactive and non-reactive objects (#12576) 2025-02-20 17:00:31 +08:00
FatRadish 295b5ec19b
fix(reactivity): ensure markRaw objects are not reactive (#12824)
close #12807
2025-02-19 14:25:30 +08:00
Özer Gökalpsezer f65a680b14 fix(reactivity): handle custom Symbol.toStringTag for collections and arrays 2025-02-11 11:41:57 +03:00
Özer Gökalpsezer b42d264da0 fix(reactivity): support custom Symbol.toStringTag for collections 2025-02-10 10:41:26 +03:00
Özer Gökalpsezer 30d1f32b83 fix(reactivity): handle objects with custom Symbol.toStringTag 2025-02-09 17:49:31 +03:00
Tycho 7ad289e1e7
fix(reactivity): trigger reactivity for Map key `undefined` (#12055)
close #12054
2024-10-11 10:39:08 +08:00
Evan You 6001e5c81a
fix(reactivity): fix property dep removal regression
close #12020
close #12021
2024-09-26 16:58:38 +08:00
Konv Suu 67d6596d40
fix(reactivity): fix markRaw error on already marked object (#11864)
close #11862
2024-09-10 15:40:43 +08:00
Evan You 313e4bf552
fix(reactivity): avoid infinite recursion when mutating ref wrapped in reactive
close #11696
2024-08-29 14:10:29 +08:00
LiuSeen 50ddafe91b
fix(reactivity): shallowReactive map "unwraps" the nested refs (#8503)
fix #8501
fix #11249
2024-07-16 15:07:06 +08:00
Wick 9da34d7af8
fix(reactivity): computed should not be detected as true by isProxy (#10401) 2024-04-15 22:55:37 +08:00
Evan You 969c5fb30f
fix(reactivity): fix hasOwnProperty key coercion edge cases 2024-04-15 17:18:53 +08:00
Artyom Tuchkov 2312184bc3
fix(reactivity): skip non-extensible objects when using `markRaw` (#10289)
close #10288
2024-02-08 10:57:57 +08:00
三咲智子 Kevin Deng bfe6b459d3
style: update format & lint config (#9162)
Co-authored-by: 丶远方 <yangpanteng@gmail.com>
Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
Co-authored-by: Guo Xingjun <99574369+Plumbiu@users.noreply.github.com>
2023-12-26 19:39:47 +08:00
Evan You 6ecbd5ce2a fix(reactivity): fix mutation on user proxy of reactive Array
close #9742
close #9751
close #9750
2023-12-07 13:26:30 +08:00
b401243855
chore(types): remove unnecessary @ts-ignore or use @ts-expected-error (#7178) 2023-07-10 18:00:32 +08:00
zqran 924069891e
test(reactivity): bigint test for non-observable values (#6177) 2023-07-10 17:51:30 +08:00
丶远方 3294e50b0b
chore: update tests to use expect.toBeInstanceOf (#8154) 2023-05-08 14:34:24 +08:00
izayl 848ccf56fb
test(reactive): add test case of mutation in original reflecting in observed value (#2118) 2020-09-15 10:49:59 -04:00
Pick 02dcc68c24
test(reactivity): improve built-in Collection subclass test cases (#1885) 2020-08-19 16:22:31 -04:00
ᴜɴвʏтᴇ d005b578b1
fix(reactivity): accept subtypes of collections (#1864) 2020-08-17 12:17:46 -04:00
wujieZ 2787c34cd4
fix(reactivity): use isExtensible instead of isFrozen (#1753)
close #1784
2020-08-05 11:53:50 -04:00
Evan You 5c74243211 test: move mockWarn into setup files 2020-07-27 22:58:51 -04:00
Yang Mingshan 80e1693e1f
fix(reactivity): replaced ref in reactive object should be tracked (#1058) 2020-06-12 09:20:43 -04:00
蜗牛老湿 426803046f
test(reactivity): 100% reactivity coverage (#1299) 2020-06-11 16:55:56 -04:00
Evan You 10bb34bb86 fix(reactivity): fix toRaw for objects prototype inherting reactive
fix #1246
2020-06-11 15:12:57 -04:00
Carlos Rodrigues c97d1bae56
fix(reactivity): shallowReactive collection to not-readonly (#1212) 2020-06-09 17:20:30 -04:00
Carlos Rodrigues 488e2bcfef
fix(reactivity): shallowReactive for collections (#1204)
close #1202
2020-05-18 11:17:37 -04:00
XinPing Wang 8bab78b648 test: reactive proto 2020-05-03 15:36:19 -04:00
Evan You 09b4202a22 refactor(reactivity): adjust APIs
BREAKING CHANGE: Reactivity APIs adjustments:

- `readonly` is now non-tracking if called on plain objects.
  `lock` and `unlock` have been removed. A `readonly` proxy can no
  longer be directly mutated. However, it can still wrap an already
  reactive object and track changes to the source reactive object.

- `isReactive` now only returns true for proxies created by `reactive`,
   or a `readonly` proxy that wraps a `reactive` proxy.

- A new utility `isProxy` is introduced, which returns true for both
  reactive or readonly proxies.

- `markNonReactive` has been renamed to `markRaw`.
2020-04-15 16:45:20 -04:00
Evan You 1b2149dbb2 fix(reactivity): should not observe frozen objects
fix #867
2020-03-23 11:28:20 -04:00
Evan You 775a7c2b41 refactor: preserve refs in reactive arrays
BREAKING CHANGE: reactive arrays no longer unwraps contained refs

    When reactive arrays contain refs, especially a mix of refs and
    plain values, Array prototype methods will fail to function
    properly - e.g. sort() or reverse() will overwrite the ref's value
    instead of moving it (see #737).

    Ensuring correct behavior for all possible Array methods while
    retaining the ref unwrapping behavior is exceedinly complicated; In
    addition, even if Vue handles the built-in methods internally, it
    would still break when the user attempts to use a 3rd party utility
    functioon (e.g. lodash) on a reactive array containing refs.

    After this commit, similar to other collection types like Map and
    Set, Arrays will no longer automatically unwrap contained refs.

    The usage of mixed refs and plain values in Arrays should be rare in
    practice. In cases where this is necessary, the user can create a
    computed property that performs the unwrapping.
2020-02-21 17:48:39 +01:00
Dmitry Sharshakov 7f38c1e0ff
feat(reactivity): add shallowReactive function (#689) 2020-02-04 10:15:27 -05:00
Evan You aefb7d282e fix(reactivity): Array methods relying on identity should work with raw values 2020-01-23 13:42:31 -05:00
Evan You 2569890e31 refactor: move mockWarn utility to @vue/shared
close #652
2020-01-22 09:29:45 -05:00
Evan You 1c56d1bf19 test: test unwrapping computed refs 2019-10-14 11:21:09 -04:00
相学长 cbb4b19cfb feat(reactivity): ref(Ref) should return Ref (#180) 2019-10-10 11:34:42 -04:00
Carlos Rodrigues 600ec5de42 chore: improve typings in reactivity tests (#96) 2019-10-05 10:39:40 -04:00
Evan You 3efe0ba3cd test: jest warning assert utils 2019-08-26 16:08:23 -04:00
Evan You aacad85058 test: fix reactivity tests 2019-08-20 09:58:10 -04:00
Evan You caba6d5c9e wip: state -> reactive, value -> ref 2019-08-16 09:42:46 -04:00