Commit Graph

26 Commits

Author SHA1 Message Date
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
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
Carlos Rodrigues
28b4c317b4
feat(types): expose ToRefs type (#1037) 2020-04-24 13:10:16 -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
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
e9024bf1b7 feat(reactivity): expose unref and shallowRef 2020-02-22 04:39:32 +01:00
Evan You
d9d63f21b1 fix(reactivity): avoid cross-component dependency leaks in setup() 2020-02-17 23:14:07 -05:00
Dmitry Sharshakov
7f38c1e0ff
feat(reactivity): add shallowReactive function (#689) 2020-02-04 10:15:27 -05: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
Evan You
d9c6ff372c feat(core): allow passing explicit refs via props 2019-11-06 12:51:26 -05:00
Dmitry Sharshakov
74d8c5919d types: improve computed types (#343) 2019-10-21 13:57:20 -04:00
Evan You
360f3b4f37 types: improve type exports 2019-09-06 12:58:31 -04:00
Evan You
6c7cbb0dc9 types: avoid plain objects with value being mistaken as refs 2019-09-05 18:32:19 -04:00
Evan You
a6de6daa17 wip: disable tracking in all hooks 2019-09-04 18:20:47 -04:00
Evan You
7ecdc79d5e test: finish tests for watch api 2019-08-27 11:35:22 -04:00
Evan You
589d3c2feb refactor: immutable -> readonly 2019-08-23 09:38:32 -04:00
Evan You
0519e10518 wip: make computed implementation consistent 2019-08-20 09:45:28 -04:00
Evan You
b218678c66 feat: toRefs 2019-08-20 09:38:00 -04:00
Evan You
caba6d5c9e wip: state -> reactive, value -> ref 2019-08-16 09:42:46 -04:00
Evan You
bfe6987323 refactor: adjust reactivity structure 2019-06-12 00:03:50 +08:00
Evan You
471899af8b refactor: rename reactivity package name and APIs 2019-06-11 23:50:28 +08:00