Commit Graph

105 Commits

Author SHA1 Message Date
Evan You
03a7a73148 fix(reactivity): ensure computed always expose value
fix #3099

Also changes the original fix for #910 by moving the fix from
reactivity to the scheduler
2021-05-27 20:53:21 -04:00
HcySunYang
5036c51cb7
fix(reactivity): fix tracking for readonly + reactive Map (#3604)
fix #3602
2021-05-07 18:49:11 -04:00
kiyon
7a8bac73e1
chore: fix typo in test case description 2021-04-16 10:43:56 +08:00
liaoliao666
c61e767422
fix(reactivity): should not trigger when setting value to same proxy (#2904) 2021-03-29 17:52:57 -04:00
Thorsten Lünborg
22cc4a7659
fix(reactivity): ensure that shallow and normal proxies are tracked seperately (close #2843) (#2851)
fix #2843
2021-03-26 15:39:56 -04:00
HcySunYang
68de9f408a
fix(reactivity): fix shallow readonly behavior for collections (#3003)
fix #3007
2021-03-26 15:10:21 -04:00
Evan You
41e02f0fac fix(reactivity): ensure computed can be wrapped by readonly
fix #3376
2021-03-25 11:23:34 -04:00
Thorsten Lünborg
6e46a574ed
fix(reactivity): ensure add/set on reactive collections return the proxy (#2534)
fix #2530
2020-11-27 14:16:00 -05:00
Thorsten Lünborg
34703082fd
fix(reactivity): ensure readonly on plain arrays doesn't track array methods. (#2506)
fix #2493
2020-11-27 10:24:31 -05:00
Evan You
0e5a3c47a7 fix(reactivity): track length on for in iteration on Array
fix #2427
2020-10-19 17:37:35 -04:00
ᴜɴвʏтᴇ
f316a332b0
fix(reactivity): avoid length mutating array methods causing infinite updates (#2138)
fix #2137

Co-authored-by: Evan You <yyx990803@gmail.com>
2020-09-18 01:01:36 -04: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
Carlos Rodrigues
d4bf9bcbb4
fix(reactivity): toRef should not wrap a ref (#2103) 2020-09-15 10:29:38 -04:00
Pick
fcf9b2cf19
fix(reactivity): should trigger collection's write-function correctly on non-reactive keys (#1992) 2020-09-14 21:31:04 -04:00
Hefty
0d4910a211
fix(reactivity): add NaN prop on Array should not trigger length dependency. (#1998) 2020-09-14 20:40:09 -04:00
Pick
97bc30edad
perf(reactivity): avoid triggering Map.has twice on non-reactive keys (#1972) 2020-08-26 11:41:18 -04:00
xxgjzftd
d5c4f6ed4d
perf(reactivity): add existing index or non-integer prop on Array should not trigger length dependency (#1969) 2020-08-26 11:28:58 -04:00
Evan You
016ba116a8 fix(reactivity): fix iOS 12 JSON.stringify error on reactive objects
- Use WeakMap for raw -> reactive/readonly storage. This is slightly
  more expensive than using a field on the taget object but avoids
  polluting the original.

- also fix Collection.forEach callback value

fix #1916
2020-08-24 15:34:04 -04:00
ᴜɴвʏтᴇ
3c05f8bbd6
fix(reactivity): unwrap non-index accessed refs on reactive arrays (#1859)
close #1846
2020-08-21 13:36:41 -04:00
Evan You
7454e2a52b build(deps): upgrade to TypeScript 4 2020-08-20 17:48:28 -04:00
Pick
02dcc68c24
test(reactivity): improve built-in Collection subclass test cases (#1885) 2020-08-19 16:22:31 -04:00
Jordan Pittman
4172fdb90c
feat(reactivity): return array when calling toRefs on array (#1768)
close #1764
2020-08-18 12:11:13 -04:00
ᴜɴвʏтᴇ
d005b578b1
fix(reactivity): accept subtypes of collections (#1864) 2020-08-17 12:17:46 -04:00
Evan You
50adc014f5 refactor(reactivity): readonly collections should not track 2020-08-06 12:10:03 -04:00
Evan You
ed4381020f fix(reactivity): readonly+reactive collection should also expose readonly+reactive values
fix #1772
2020-08-06 11:18:16 -04:00
wujieZ
2787c34cd4
fix(reactivity): use isExtensible instead of isFrozen (#1753)
close #1784
2020-08-05 11:53:50 -04:00
Evan You
730e39eb76 refactor: remove unnecessary conditions and test case 2020-07-28 12:26:14 -04:00
Evan You
5c74243211 test: move mockWarn into setup files 2020-07-27 22:58:51 -04:00
Evan You
7edfdf7e23 fix(reactivity): avoid tracking internal symbols in has trap
fix #1683
2020-07-22 21:23:32 -04:00
Carlos Rodrigues
dabdc5e115
feat(computed): add readonly flag if no setter is provided (#1654) 2020-07-20 17:35:31 -04:00
Pick
028a8c20df
test(reactivity): adjust ref unwrap test inside arrays (#1457) 2020-06-29 12:10:29 -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
doly mood
d3c436ae2e
feat(types): mixins/extends support in TypeScript (#626) 2020-06-09 10:37:00 -04:00
Carlos Rodrigues
488e2bcfef
fix(reactivity): shallowReactive for collections (#1204)
close #1202
2020-05-18 11:17:37 -04:00
龙腾道
e08f6f0ede
fix(reactivity): use correct thisArg for collection method callbacks (#1132) 2020-05-06 13:41:34 -04:00
XinPing Wang
8bab78b648 test: reactive proto 2020-05-03 15:36:19 -04:00
HiiTea
22717772dd
chore: fix typos (#1090) 2020-05-01 09:42:58 -04:00
Evan You
2acf3e84b9 feat(reactivity): add triggerRef API
Also make shallowRef assignment behavior consistent with normal ref
2020-04-22 18:00:10 -04:00
Evan You
b0d4df9743 perf(reactivity): ref should not trigger if value did not change
Note: shallowRef will always trigger on assignment because it does not
account for deep mutations

close #1012
2020-04-22 15:11:01 -04:00
Carlos Rodrigues
d7ae1d0244
test(reactivity): add tests for object with symbols (#969) 2020-04-16 09:24:46 -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
3178504273 refactor(reactivity): make readonly non-tracking 2020-04-14 23:49:46 -04:00
Evan You
486dc188fe feat(reactivity): add support for toRef API 2020-04-14 20:49:18 -04:00
Evan You
b83c580131 feat(reactivity): add support for customRef API 2020-04-14 20:45:46 -04:00
Evan You
e8a866ec99 refactor(reactivity): remove stale API markReadonly
BREAKING CHANGE: `markReadonly` has been removed.
2020-04-13 17:39:48 -04:00
Evan You
5dcc645fc0 fix(reactivity): track reactive keys in raw collection types
Also warn against presence of both raw and reactive versions of the
same object in a collection as keys.

fix #919
2020-04-04 12:57:22 -04:00
Evan You
0764c33d3d fix(reactivity): scheduled effect should not execute if stopped
fix #910
2020-04-02 19:50:48 -04:00