Commit Graph

513 Commits

Author SHA1 Message Date
Evan You 41e02f0fac fix(reactivity): ensure computed can be wrapped by readonly
fix #3376
2021-03-25 11:23:34 -04:00
Cédric Exbrayat 57e1aa815b
chore: fix ownKeys signature (#3313) 2021-03-03 11:26:49 -05:00
Evan You 1a955e2278 release: v3.0.7 2021-03-01 10:59:29 -05:00
zhufengzhufeng 9cd988342c
perf(reactivity): only call Set.add if doesn't already have value (#3307) 2021-02-25 14:57:35 -05:00
Evan You d9f91e26f9 release: v3.0.6 2021-02-24 15:19:31 -05:00
HcySunYang dd02cf37d5
perf(reactivity): should not track `__isVue` (#2940) 2021-02-03 19:28:07 +01:00
07akioni 4ca4666d58
fix(toRef): ref created from union typed prop can't be used in watch (#3048) 2021-02-03 19:12:51 +01:00
Evan You 5a5d037dbb release: v3.0.5 2020-12-30 15:50:28 -05:00
Evan You d067fb2dbb release: v3.0.4 2020-12-02 17:23:43 -05:00
Evan You e315d84936 fix(types): fix ToRefs type on union value types
fix #2687
2020-12-02 14:58:03 -05: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 bd6e211287 release: v3.0.3 2020-11-25 11:16:21 -05:00
Evan You 8e20375372 fix(types): ensure correct type for toRef and toRefs on existing refs 2020-10-27 18:50:34 -04:00
Evan You 118502a4b8 chore: comments [ci skip] 2020-10-23 14:37:09 -04:00
Evan You f2d03a59c6 release: v3.0.2 2020-10-20 16:24:12 -04:00
Evan You 0e5a3c47a7 fix(reactivity): track length on for in iteration on Array
fix #2427
2020-10-19 17:37:35 -04:00
Evan You f17f0ddf68 release: v3.0.1 2020-10-15 12:37:21 -04:00
Lory Lee 6b8cf998c4
chore: add missing space in warning message (#2266) [ci skip] 2020-10-13 16:18:22 -04:00
edison af1f5d33aa
refactor(reactivity): remove `keyIsSymbol` (#2262) 2020-10-13 16:17:52 -04:00
Yang Mingshan 7cc09ca8a5
fix(reactivity): use resetTracking instead of enableTracking (#2174) 2020-10-13 15:32:46 -04:00
Evan You 390589ec6d fix(reactivity): should not trigger watch on computed ref when value is unchanged
fix #2231
2020-10-06 18:16:20 -04:00
HcySunYang ea1f87eabf
fix(reactivity): should add allowRecurse to the effect (#2213)
So that the scheduler also respects effect's allowRecurse option.

fix #2200
2020-10-05 16:36:02 -04:00
Nathan Shively-Sanders d52d139b85
types: fix Typescript 4.1 compile error (#2219)
close #2218
2020-09-28 12:39:14 -04:00
Evan You d8c1536ead release: v3.0.0 2020-09-18 11:28:05 -04:00
Evan You 876ecc8672 release: v3.0.0-rc.13 2020-09-18 01:39:30 -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
Evan You 985bd2bcb5 release: v3.0.0-rc.12 2020-09-16 13:50:13 -04:00
Evan You 3810de7d6b fix(reactivity): effect shoud only recursively self trigger with explicit options
fix #2125
2020-09-16 10:52:31 -04:00
Evan You f2ef7d7c8e release: v3.0.0-rc.11 2020-09-15 13:15:42 -04:00
Carlos Rodrigues 4fd468aced
types(runtime-core): refactor defineComponent (#1883) 2020-09-15 11:46:11 -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
Evan You 0124eacc91 refactor(reactivity): refactor iteration key trigger logic + use more robust Map/Set check 2020-09-14 11:26:34 -04:00
Evan You 5f4053967c fix(reactivity): revert ac81dcf
fix #2043
2020-09-04 11:10:26 -04:00
Evan You 4386653e76 release: v3.0.0-rc.10 2020-09-02 12:41:54 -04:00
Evan You 691a4b9530 perf(reactivity): no need to proxy has/ownKeys for readonly objects 2020-09-01 20:52:48 -04:00
Guillaume Chau 5df71b739d chore: add repository directories 2020-08-30 15:06:06 +02:00
Evan You 94d94bafc5 release: v3.0.0-rc.9 2020-08-26 18:21:18 -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 ede2e0d1b5 release: v3.0.0-rc.8 2020-08-25 10:31:52 -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
Evan You 6602d6dbff release: v3.0.0-rc.7 2020-08-21 14:13:05 -04:00
Robbin Baauw 07919e0065
perf(reactivity): improve ref performance by using class-based implementation (#1900) 2020-08-21 13:47:41 -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
Evan You 91c4735416 release: v3.0.0-rc.6 2020-08-19 18:17:42 -04:00
Pick 02dcc68c24
test(reactivity): improve built-in Collection subclass test cases (#1885) 2020-08-19 16:22:31 -04:00
Carlos Rodrigues c86e7ad11b
types(reactivity): improve typings for `shallowRef` (#1780) 2020-08-18 23:34:29 -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
Pick 44448fdd22
types(reactivity): add dts for proxyRefs & improve typings (#1786) 2020-08-14 17:37:36 -04:00
Evan You ac81dcf0cc fix(reactivity): effect should still check sync self-trigger 2020-08-13 17:45:21 -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 848d9ce2ea release: v3.0.0-rc.5 2020-07-28 17:42:05 -04:00
Evan You aa06b1034d
feat(reactivity): `proxyRefs` method and `ShallowUnwrapRefs` type (#1682)
* feat(reactivity): `proxyRefs` method and `ShallowUnwrapRefs` type

BREAKING CHANGE: template auto ref unwrapping are now applied shallowly,
i.e. only at the root level. See https://github.com/vuejs/vue-next/pull/1682 for
more details.
2020-07-28 16:30:56 -04:00
Evan You 730e39eb76 refactor: remove unnecessary conditions and test case 2020-07-28 12:26:14 -04:00
Evan You b7ef38b773 fix(reactivity): fix ref mutation debugger event values 2020-07-28 12:01:34 -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
Evan You d63daaf9b6 release: v3.0.0-rc.4 2020-07-21 15:40:46 -04:00
Evan You 7753485baa release: v3.0.0-rc.3 2020-07-21 15:27:26 -04:00
Zardddddd60 3e412c10e0
refactor(reactive): reduce code size by assigning to a local variable (#1634) 2020-07-21 10:33:09 -04:00
Carlos Rodrigues dabdc5e115
feat(computed): add readonly flag if no setter is provided (#1654) 2020-07-20 17:35:31 -04:00
Evan You 1f4045a086 release: v3.0.0-rc.2 2020-07-19 14:52:42 -04:00
Evan You 0ea14cade9 release: v3.0.0-rc.1 2020-07-17 15:30:17 -04:00
Pick 527c2c8bbb
feat(types): expose DeepReadonly type (#1606) 2020-07-17 09:28:50 -04:00
Evan You 5ed73cd874 release: v3.0.0-beta.24 2020-07-16 13:51:52 -04:00
Evan You 8b5d153d7f release: v3.0.0-beta.23 2020-07-16 12:48:56 -04:00
Zardddddd60 ecf872fc95
refactor(reactive): remove unnecessary args handling in reactiveEffect (#1593) 2020-07-15 23:19:15 -04:00
Evan You 4535b1bde8 chore: remove outdated options 2020-07-15 17:05:00 -04:00
Evan You fcbefdb769 release: v3.0.0-beta.22 2020-07-15 12:43:41 -04:00
Pick b772bba558
feat(types/reactivity): use `DeepReadonly` type for `readonly` return type (#1462)
close #1452
2020-07-15 09:27:21 -04:00
Evan You 9188e9ea74 release: v3.0.0-beta.21 2020-07-14 17:18:07 -04:00
Evan You 20df2f3817 release: v3.0.0-beta.20 2020-07-08 12:45:30 -04:00
Felix Rilling 829b35e426
chore: typo fixes (#1546)
* chore: fix typos in comments/JSDoc.

* chore: fix typo in internal function name.

* chore: fix typos in test comments/descriptions/variable names.
2020-07-08 12:32:42 +02:00
Evan You d5ab70ba66 release: v3.0.0-beta.19 2020-07-07 10:04:31 -04:00
Pick 4f6460a71f
chore(reactivity): remove unused comment (#1485) [ci skip] 2020-07-06 15:57:54 -04:00
Evan You 7f83856f34 release: v3.0.0-beta.18 2020-07-01 21:06:25 -04:00
Pick 5c490f1c45
refactor(computed): deprecated computedRunners (#1458) 2020-07-01 15:39:13 -04:00
Evan You f6da6bf999 release: v3.0.0-beta.17 2020-06-30 12:10:15 -04:00
Pick c69ca88c04
refactor(types): simplify UnwrapRefSimple (#1466) 2020-06-30 12:02:21 -04:00
Evan You ec3c12ee10 release: v3.0.0-beta.16 2020-06-29 18:34:50 -04:00
Evan You 82b28a5ecb fix(types): should unwrap array -> object -> ref 2020-06-29 12:26:28 -04:00
Pick 028a8c20df
test(reactivity): adjust ref unwrap test inside arrays (#1457) 2020-06-29 12:10:29 -04:00
edison 178e89305d
chore(reactivity): use consistent naming for ReactiveFlags enum (#1428) 2020-06-26 09:32:09 -04:00
Pick f54be6a462
refactor(types): simplify UnwrapRef + specify iterable method return type (#1444) 2020-06-25 12:04:14 -04:00
underfin c43a6e61a0
perf(reactivity): should not track `__v_isRef` (#1392) 2020-06-25 11:40:49 -04:00
Pick 8899a90fc4
refactor(types): simplified UnwrapRef (#1390) 2020-06-17 16:06:55 -04:00
Evan You cf2f278f48 release: v3.0.0-beta.15 2020-06-12 18:09:05 -04:00
Evan You d863ce721f refactor: improve base getter readability 2020-06-12 09:25:40 -04:00
Yang Mingshan 80e1693e1f
fix(reactivity): replaced ref in reactive object should be tracked (#1058) 2020-06-12 09:20:43 -04:00
蜗牛老湿 f3eac11058
chore(reactivity): use ReactiveFlags instead of __v_ properties (#1313) 2020-06-11 17:32:44 -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
Evan You 80c868aefe workflow: setup eslint for prohibited syntax and globals
fix #1285
2020-06-10 16:54:23 -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
Evan You 32b3f78a36 release: v3.0.0-beta.14 2020-05-18 14:42:11 -04:00
Carlos Rodrigues 488e2bcfef
fix(reactivity): shallowReactive for collections (#1204)
close #1202
2020-05-18 11:17:37 -04:00
zhangenming 6574a5bf29
chore: merge imports (#1182) 2020-05-18 10:12:14 -04:00
Evan You 449fd05ad6 release: v3.0.0-beta.13 2020-05-16 21:53:47 -04:00
Evan You 3c88299f6a release: v3.0.0-beta.12 2020-05-11 15:52:37 -04:00
Evan You 7887c54dfe release: v3.0.0-beta.11 2020-05-11 14:25:36 -04:00
Evan You 13acb9134e release: v3.0.0-beta.10 2020-05-07 11:21:18 -04:00
龙腾道 e08f6f0ede
fix(reactivity): use correct thisArg for collection method callbacks (#1132) 2020-05-06 13:41:34 -04:00
龙腾道 037fa07113
fix(reactivity): fix __proto__ access on proxy objects (#1133) 2020-05-06 09:08:44 -04:00
Evan You c32ed52b97 release: v3.0.0-beta.9 2020-05-04 17:14:42 -04:00
Evan You 3c3fe88c64 release: v3.0.0-beta.8 2020-05-04 10:49:23 -04:00
Evan You c6217b4d46 refactor(types): use pure type symbol 2020-05-04 09:38:32 -04:00
Evan You bc1f097e29 fix(types/reactivity): fix ref type inference on nested reactive properties with .value
fix #1111
2020-05-04 08:51:17 -04:00
Evan You f40f3a0e95 fix(reactivity): avoid polluting Object prototype 2020-05-04 08:51:17 -04:00
Jackliu 42a99d28ae
chore: typo (#1113) 2020-05-04 10:30:24 +02:00
Evan You 6be2b73f8a fix(reactivity): check own property for existing proxy of target
fix #1107
2020-05-03 15:36:19 -04:00
XinPing Wang 8bab78b648 test: reactive proto 2020-05-03 15:36:19 -04:00
Evan You 0c48558f4c chore: remove commented stale code [ci skip] 2020-05-02 17:08:54 -04:00
Evan You 0dc44a6a86 release: v3.0.0-beta.7 2020-05-02 17:06:16 -04:00
Evan You d901b6bea8 refactor(reactivity): use more efficient reactive checks
WeakSets and WeakMaps shows degrading performance as the amount of
observed objects increases. Using hidden keys result in better
performance especially when repeatedly creating large amounts of
reactive proxies.

This also makes it possible to more efficiently declare non-reactive
objects in userland.
2020-05-02 16:58:17 -04:00
Evan You b570287dfe release: v3.0.0-beta.6 2020-05-01 18:56:53 -04:00
Evan You b40fcbc4c6 fix(types): augment ref unwrap bail types in appropriate packages
Packages can now augment the ref unwrap bail types in their own `d.ts`.
Also updated the build script to auto concat any files in a package's
`types` directory to the final generated `d.ts`.

- `@vue/reactivity` should no longer require `libs: ["DOM"]` in tsconfig
- Properly bail on `VNode` and `ComponentPublicInstance` in runtime-core
2020-05-01 16:14:30 -04:00
HiiTea 22717772dd
chore: fix typos (#1090) 2020-05-01 09:42:58 -04:00
Evan You c9bf7ded2e refactor(types): mark internal API exports and exclude from d.ts
BREAKING CHANGE: Internal APIs are now excluded from type decalrations.
2020-04-30 17:04:35 -04:00
Evan You a5bb1d02b7 release: v3.0.0-beta.5 2020-04-30 16:20:25 -04:00
Evan You 352c369704 chore: remove stale _isVue checks 2020-04-30 14:45:25 -04:00
Evan You d29aefcf99 release: v3.0.0-beta.4 2020-04-24 16:20:20 -04:00
Carlos Rodrigues 28b4c317b4
feat(types): expose `ToRefs` type (#1037) 2020-04-24 13:10:16 -04:00
susiwen8 ad2b940c17
chore: remove unnecessary export (#1044) [ci skip] 2020-04-24 13:02:44 -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 0bdd889156
fix(types): fix ref(false) type to Ref<boolean> (#1028) 2020-04-22 11:54:54 -04:00
Evan You 6fefeafe98 release: v3.0.0-beta.3 2020-04-20 17:00:26 -04:00
limichange fa40d1ef3a
refactor(reactivity): simplify if condition (#1002) 2020-04-20 13:39:35 -04:00
Evan You 218e6e1667 build: adjust build formats
- Rename `esm` to `esm-browser`
- Add runtime-only build for `esm-browser`
- Add default CDN alias for jsdelivr
2020-04-19 18:43:21 -04:00
Evan You c1a85cb124 release: v3.0.0-beta.2 2020-04-17 11:01:01 -04:00
Evan You ca6912554c release: v3.0.0-beta.1 2020-04-16 15:45:04 -04:00
Cédric Exbrayat 4d014dc3d3
fix(reactivity): remove Symbol.observable (#968)
* chore: add @types/node as an explicit dependency

As `tsconfig.json` references it, it should be listed in the dependencies.
It currently uses an older version: this commit also bumps to the latest v12 version, and fixes a typing issue.

* fix(reactivity): remove Symbol.observable

`Symbol.observable` is brought by `@types/node@12` and is not a "well-known" typescript symbol https://www.typescriptlang.org/docs/handbook/symbols.html that can be find in lib.es20xx like the others. It has been removed in `@types/node@v13`.
It means that an application using vue@3.0.0-alpha.13 does not compile unless it explicitely adds `@types/node@v12` as a dependency and `node` in its own tsconfig types.
2020-04-16 09:33:30 -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 11654a6e50 release: v3.0.0-alpha.13 2020-04-15 12:46:26 -04:00
pikax 8a74260b70 types: remove tuple check and add type check for tuple 2020-04-15 16:22:44 +01:00
Carlos Rodrigues 70b55d797f
Apply suggestions from code review
Co-Authored-By: Evan You <yyx990803@gmail.com>
2020-04-15 16:07:07 +01:00
pikax dcb5985c00 Merge remote-tracking branch 'github/master' into changing_unwrap_ref 2020-04-15 15:54:26 +01:00
Evan You 3178504273 refactor(reactivity): make readonly non-tracking 2020-04-14 23:49:46 -04:00
Evan You 09b44e07cb refactor(reactivity): move array ref handling into getter 2020-04-14 22:18:58 -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 78977c3997 fix(scheduler): sort jobs before flushing
This fixes the case where a child component is added to the queue before
its parent, but should be invalidated by its parent's update. Same logic
was present in Vue 2.

Properly fixes #910
ref: https://github.com/vuejs/vue-next/issues/910#issuecomment-613097539
2020-04-14 17:31:35 -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
pikax 6a66b7b60a Merge remote-tracking branch 'github/master' into changing_unwrap_ref 2020-04-13 18:32:14 +01:00
Thorsten Lünborg 33ccfc0a8b
fix(types): UnwrapRef should bail on DOM element types (#952)
fix #951
2020-04-13 11:51:32 -04:00
pikax c20d8af8c0 types: add symbolExtract to extract all known symbols
#951
2020-04-12 11:45:56 +01:00
Evan You 1d9f8fc979 release: v3.0.0-alpha.12 2020-04-08 18:59:49 -04:00
pikax ab9add4f78 types: bring back my changes 2020-04-08 21:34:00 +01:00
ysj16 667e42065d
chore: typo (#928) 2020-04-06 09:09:44 -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 7402951d94 release: v3.0.0-alpha.11 2020-04-03 21:45:50 -04:00
Evan You f3b6559408 fix(types/reactivity): add generics constraint for markNonReactive
fix #917
2020-04-03 21:06:03 -04:00
Evan You 0764c33d3d fix(reactivity): scheduled effect should not execute if stopped
fix #910
2020-04-02 19:50:48 -04:00
Evan You de81faf00a release: v3.0.0-alpha.10 2020-03-24 18:33:40 -04:00
Evan You 45ba06ac5f fix(reactivity): should not trigger map keys iteration when keys did not change
fix #877
2020-03-24 12:43:06 -04:00
Evan You 1b2149dbb2 fix(reactivity): should not observe frozen objects
fix #867
2020-03-23 11:28:20 -04:00
Evan You b8c1be18f3 refactor(types): use stricter settings
fix #847
2020-03-23 11:08:22 -04:00
Evan You ba9a91c48c refactor: remove null comparisons 2020-03-18 18:14:51 -04:00
Evan You 5282ff0edb release: v3.0.0-alpha.9 2020-03-16 18:56:44 -04:00
djy0 b13886b1ba
types(reactivity): remove this in get accessor, fix #800 (#806) 2020-03-09 16:01:49 -04:00
Evan You c75388d538 release: v3.0.0-alpha.8 2020-03-06 15:58:40 -05:00
Evan You 274f81c5db fix(reactivity): allow effect trigger inside no-track execution contexts
fix #804
2020-03-06 12:11:37 -05:00
hareku 643ff233af
types(reactivity): add undefined type to ref/shallowRef when no args (#791) 2020-03-06 11:32:39 -05:00
Evan You a3066581f3 fix(reactivity): should not trigger length dependency on Array delete
close #774
2020-03-06 11:31:10 -05:00
Evan You cc69fd72e3 fix(reactivity): Map/Set identity methods should work even if raw value contains reactive entries
fix #799
2020-03-06 11:10:02 -05:00
Evan You 16f9e63951
types: remove 'this' annotation from 'get' accessor (#801)
The next version of Typescript disallows 'this' parameter annotations on
accessors, which causes vue-next to fail to compile.

This PR removes the annotation and adds a cast instead.

Fixes #800
2020-03-05 16:57:52 -06:00
Evan You bcb2a9b4a6 build: make @vue/shared public
This avoids it being inlined multiple times in esm bundler builds
2020-02-29 22:04:42 -05:00
Evan You 312513d255 release: v3.0.0-alpha.7 2020-02-26 14:36:38 -05:00
Evan You 3206e5dfe5 fix(types): shallowRef should not unwrap value type 2020-02-25 20:43:01 -05:00
Evan You d4c6957e2d fix(types): ref value type unwrapping should happen at creation time 2020-02-25 19:44:06 -05:00
Evan You 9ab22c7ae6 release: v3.0.0-alpha.6 2020-02-22 08:25:32 +01:00
Evan You b36a76fe23 chore: remove debugger [ci skip] 2020-02-22 05:19:22 +01:00
guaijie 76c7f54269
perf(effect): optimize effect trigger for array length mutation (#761) 2020-02-22 05:17:30 +01:00
Evan You e9024bf1b7 feat(reactivity): expose unref and shallowRef 2020-02-22 04:39:32 +01: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
Evan You 627b9df4a2 fix(types): improve ref typing, close #759 2020-02-21 17:45:42 +01:00
Evan You 33622d6360 perf(reactivity): only trigger all effects on Array length mutation if new length is shorter than old length 2020-02-21 15:05:16 +01:00
hareku 014acc13e9
test(reactivity): test for ref without init value (#746) 2020-02-21 14:44:41 +01:00
guaijie 5fac65589b
fix(reactivity): should trigger all effects when array length is mutated (#754) 2020-02-21 11:38:07 +01:00
Evan You 478b4cfb2c release: v3.0.0-alpha.5 2020-02-18 15:00:55 -05:00
Evan You e8e67729cb fix(reactivity): effect should handle self dependency mutations 2020-02-18 13:22:09 -05:00
Evan You e1c9153b9e fix(reactivity): trigger iteration effect on Map.set
fix #709
2020-02-18 00:09:24 -05:00
Evan You 2fb7a63943 fix(computed): support arrow function usage for computed option
fix #733
2020-02-17 23:22:25 -05:00
Evan You d9d63f21b1 fix(reactivity): avoid cross-component dependency leaks in setup() 2020-02-17 23:14:07 -05:00
jods 8874b21a7e perf(reactivity): better computed tracking (#710) 2020-02-09 15:25:17 -05:00
Dmitry Sharshakov 7f38c1e0ff
feat(reactivity): add shallowReactive function (#689) 2020-02-04 10:15:27 -05:00
Evan You d293876c34 release: v3.0.0-alpha.4 2020-01-27 16:20:00 -05:00
Evan You 763faac182 wip(ssr): revert reactivity ssr paths
The perf gains are not worth the correctness issues these paths may lead to
2020-01-27 16:00:18 -05:00
Evan You e43f5935b5 refactor: better variable naming 2020-01-27 16:00:18 -05:00
Evan You 25a0d4a65f wip(ssr): reduce reactivity overhead during ssr 2020-01-27 16:00:17 -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 b41677bf42 release: v3.0.0-alpha.3 2020-01-22 11:10:30 -05:00
Evan You 2569890e31 refactor: move mockWarn utility to @vue/shared
close #652
2020-01-22 09:29:45 -05:00
likui 0c42a6d8fa types: refactor ref unwrapping (#646) 2020-01-20 13:22:18 -05:00
Rustin 5aa9868512 test(reactivity): declare the exact type (#644) 2020-01-20 12:02:08 -05:00
IU 2b4d0d6501 types(reactivity): handle primitive + object intersection types in UnwrapRef (#614) 2020-01-16 17:47:47 -05:00
Evan You 9f65d811af release: v3.0.0-alpha.2 2020-01-13 17:44:30 -05:00
likui 63a6563106 fix(reactivity): should delete observe value (#598)
fix #597
2020-01-13 17:11:49 -05:00
Jason Yu c9bb346941 chore: update README.md (#592) [ci skip] 2020-01-07 13:19:54 -05:00
Carlos Rodrigues 985f4c91d9 types: improve isRef typing (#578) 2020-01-06 16:15:49 -05:00
Evan You 1bb1271b5e release: v3.0.0-alpha.1 2020-01-02 18:25:17 -05:00
Elad Frizi 1cf1ad5e94 test(reactivity): extracted repetitive assertions (#554) 2019-12-30 11:29:43 -05:00
Evan You 755c7b581c chore: mark get/set create calls pure 2019-12-20 11:16:46 -05:00
Evan You 0a4f306492 fix: shallowReadonly should keep reactive properties reactive
ref #552
2019-12-20 11:14:07 -05:00
Evan You bdbfead1e0 chore: adjust package.json 2019-12-19 14:19:58 -05:00
Evan You 35858cec8c build: adjust global names + allow inline overrides of build flags 2019-12-15 15:37:43 -05:00
Evan You 46c5393224 perf(reactivity): optimize effect stack 2019-12-13 23:06:55 -05:00
Evan You 136ab753b3 build: adjust esm formats 2019-12-10 22:14:02 -05:00
Evan You 8ed04ed503 build: release script 2019-12-10 21:29:52 -05:00
ztplz 02478b48eb chore: use const instead of let (#524) 2019-12-06 00:10:06 +01:00
Evan You 89a187b895 refactor(reactivity): separate track and trigger operation types 2019-12-03 11:30:24 -05:00
Evan You 57bbbb227c fix(core): propsProxy should not convert non-reactive nested values 2019-12-02 14:11:12 -05:00
ztplz 2d40466d35 chore: remove unused parameter type definitions (#481) 2019-11-22 15:35:58 -05:00
Evan You 61d8941692 types(reactivity): ref type should not expose _isRef 2019-11-08 13:29:43 -05:00
Carlos Rodrigues 68ad302714 types(reactivity): add support for tuples in ref unwrapping (#436) 2019-11-08 12:52:24 -05:00
QuincyChen d7d87622ce refactor: use isArray function from shared (#441) 2019-11-08 09:52:24 -05:00
Carlos Rodrigues c53ca29ea1 test(reactivity): Add check if the child array gets unwrap (#434) 2019-11-07 09:28:49 -05:00
Evan You d9c6ff372c feat(core): allow passing explicit refs via props 2019-11-06 12:51:26 -05:00
Junyan a02820d7e0 feat: warn when toRefs() receives non-reactive object (#430) 2019-11-05 10:44:28 -05:00
IMGSS d70497c0d4 chore: fix broken link (#420) 2019-11-04 14:33:24 -05:00
Evan You f3c1fa75f6 feat(reactivity): provide correct tracking info for refs 2019-11-02 23:20:49 -04:00
Evan You 66ecd8b47f types: setup tests for built d.ts files 2019-11-01 22:54:01 -04:00
JiZhi cb97d152b8 test(effect): add test for nested stopped effect (#417) 2019-10-30 11:36:17 -04:00
Evan You 247c53672d refactor(reactivity): simplify effect options 2019-10-30 11:11:23 -04:00
Evan You 34989ef7fe chore: license 2019-10-28 11:15:17 -04:00
Junyan d76cfba7fb refactor(reactivity): reduce code of type check (#377) 2019-10-25 11:15:04 -04:00
夜宴 57276f9dcb test(effect): add test for json methods (#371) 2019-10-25 10:17:31 -04:00
相学长 abfb2ec8ed types(reactivity): computed types remove `as` (#367) 2019-10-24 11:37:52 -04:00
Mayness 18a349ce8c fix(reactivity): account for NaN in value change checks (#361) 2019-10-23 11:53:43 -04:00
Cr 246cad7459 fix(reactivity): Map.set should trigger when adding new entry with undefined value (#364) 2019-10-23 11:00:55 -04:00
Evan You 590e4e0ba9 chore: fix DebuggerEvent export 2019-10-22 11:53:32 -04:00
Evan You af57ad110f chore: revert prettier 2019-10-22 11:53:32 -04:00
Evan You b5886189ba types: massive refactor 2019-10-22 11:53:32 -04:00
Dmitry Sharshakov 74d8c5919d types: improve computed types (#343) 2019-10-21 13:57:20 -04:00
Evan You d69d3bf765 fix(reactivity): revert to Reflect.get and add test cases 2019-10-18 15:31:28 -04:00
扩散性百万甜面包 3cd2f7e68e types: fix ref unwrapping when nested inside arrays (#331) 2019-10-18 14:54:05 -04:00
edison 60961ef5b6 perf(reactivity): optimize the performance of the `canObserve` (#330) 2019-10-18 12:11:58 -04:00
Evan You e3b68972d8 perf: minor tweaks 2019-10-17 15:02:15 -04:00
Evan You cdee65aa1b perf: revert to _isRef for perf
Benchmarking shows checking for a plain property is about 4~5x faster
than checking for a Symbol, likely because the Symbol does not fit well
into V8's hidden class model.
2019-10-17 15:02:14 -04:00
Tidyzq a72652f6e6 refactor(reactivity): immediate return (#301) 2019-10-16 01:58:11 -04:00