]> git.ipfire.org Git - thirdparty/vuejs/core.git/commit
refactor: remove implicit reactive() call on renderContext
authorEvan You <yyx990803@gmail.com>
Mon, 27 Jan 2020 20:15:22 +0000 (15:15 -0500)
committerEvan You <yyx990803@gmail.com>
Mon, 27 Jan 2020 21:00:18 +0000 (16:00 -0500)
commit6b10f0cd1da942c1d96746672b5f595df7d125b5
tree876f2ef4df90035765fda33dabebc169056e1d30
parent763faac18268ad98bca5e3cb36e209c03e566d45
refactor: remove implicit reactive() call on renderContext

reference: https://github.com/vuejs/rfcs/issues/121

BREAKING CHANGE: object returned from `setup()` are no longer implicitly
passed to `reactive()`.

  The renderContext is the object returned by `setup()` (or a new object
  if no setup() is present). Before this change, it was implicitly passed
  to `reactive()` for ref unwrapping. But this has the side effect of
  unnecessary deep reactive conversion on properties that should not be
  made reactive (e.g. computed return values and injected non-reactive
  objects), and can lead to performance issues.

  This change removes the `reactive()` call and instead performs a
  shallow ref unwrapping at the render proxy level. The breaking part is
  when the user returns an object with a plain property from `setup()`,
  e.g. `return { count: 0 }`, this property will no longer trigger
  updates when mutated by a in-template event handler. Instead, explicit
  refs are required.

  This also means that any objects not explicitly made reactive in
  `setup()` will remain non-reactive. This can be desirable when
  exposing heavy external stateful objects on `this`.
packages/runtime-core/src/apiOptions.ts
packages/runtime-core/src/component.ts
packages/runtime-core/src/componentProxy.ts