Skip to content

Commit

Permalink
feat: Run setter logic for nested setters even if value didn't change
Browse files Browse the repository at this point in the history
Run setter logic for nested setters even if value didn't change. See this:
vuejs#7828 (comment).

BREAKING CHANGE: Run setter logic for nested setters even if value didn't change.
  • Loading branch information
jan-swiecki committed Dec 16, 2018
1 parent 77d406b commit 2fd6fc1
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 13 deletions.
4 changes: 3 additions & 1 deletion dist/vue.common.js
Expand Up @@ -1030,7 +1030,9 @@ function defineReactive$$1 (
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
4 changes: 3 additions & 1 deletion dist/vue.esm.js
Expand Up @@ -1028,7 +1028,9 @@ function defineReactive$$1 (
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
4 changes: 3 additions & 1 deletion dist/vue.js
Expand Up @@ -1034,7 +1034,9 @@
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
2 changes: 1 addition & 1 deletion dist/vue.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/vue.runtime.common.js
Expand Up @@ -1021,7 +1021,9 @@ function defineReactive$$1 (
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
4 changes: 3 additions & 1 deletion dist/vue.runtime.esm.js
Expand Up @@ -1019,7 +1019,9 @@ function defineReactive$$1 (
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
4 changes: 3 additions & 1 deletion dist/vue.runtime.js
Expand Up @@ -1025,7 +1025,9 @@
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
2 changes: 1 addition & 1 deletion dist/vue.runtime.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion packages/vue-server-renderer/basic.js
Expand Up @@ -1153,7 +1153,9 @@
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
4 changes: 3 additions & 1 deletion packages/vue-server-renderer/build.js
Expand Up @@ -1161,7 +1161,9 @@ function defineReactive$$1 (
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
4 changes: 3 additions & 1 deletion packages/vue-template-compiler/browser.js
Expand Up @@ -1260,7 +1260,9 @@
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
4 changes: 3 additions & 1 deletion packages/vue-template-compiler/build.js
Expand Up @@ -1224,7 +1224,9 @@ function defineReactive$$1 (
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down
4 changes: 3 additions & 1 deletion src/core/observer/index.js
Expand Up @@ -173,7 +173,9 @@ export function defineReactive (
set: function reactiveSetter (newVal) {
const value = getter ? getter.call(obj) : val
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
// We allow same values for getters
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
Expand Down

0 comments on commit 2fd6fc1

Please sign in to comment.