Skip to content

Commit 2fd6fc1

Browse files
committed
feat: Run setter logic for nested setters even if value didn't change
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.
1 parent 77d406b commit 2fd6fc1

File tree

13 files changed

+35
-13
lines changed

13 files changed

+35
-13
lines changed

dist/vue.common.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,9 @@ function defineReactive$$1 (
10301030
set: function reactiveSetter (newVal) {
10311031
var value = getter ? getter.call(obj) : val;
10321032
/* eslint-disable no-self-compare */
1033-
if (newVal === value || (newVal !== newVal && value !== value)) {
1033+
// We allow same values for getters
1034+
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
1035+
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
10341036
return
10351037
}
10361038
/* eslint-enable no-self-compare */

dist/vue.esm.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,9 @@ function defineReactive$$1 (
10281028
set: function reactiveSetter (newVal) {
10291029
var value = getter ? getter.call(obj) : val;
10301030
/* eslint-disable no-self-compare */
1031-
if (newVal === value || (newVal !== newVal && value !== value)) {
1031+
// We allow same values for getters
1032+
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
1033+
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
10321034
return
10331035
}
10341036
/* eslint-enable no-self-compare */

dist/vue.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,9 @@
10341034
set: function reactiveSetter (newVal) {
10351035
var value = getter ? getter.call(obj) : val;
10361036
/* eslint-disable no-self-compare */
1037-
if (newVal === value || (newVal !== newVal && value !== value)) {
1037+
// We allow same values for getters
1038+
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
1039+
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
10381040
return
10391041
}
10401042
/* eslint-enable no-self-compare */

dist/vue.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue.runtime.common.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,9 @@ function defineReactive$$1 (
10211021
set: function reactiveSetter (newVal) {
10221022
var value = getter ? getter.call(obj) : val;
10231023
/* eslint-disable no-self-compare */
1024-
if (newVal === value || (newVal !== newVal && value !== value)) {
1024+
// We allow same values for getters
1025+
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
1026+
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
10251027
return
10261028
}
10271029
/* eslint-enable no-self-compare */

dist/vue.runtime.esm.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,9 @@ function defineReactive$$1 (
10191019
set: function reactiveSetter (newVal) {
10201020
var value = getter ? getter.call(obj) : val;
10211021
/* eslint-disable no-self-compare */
1022-
if (newVal === value || (newVal !== newVal && value !== value)) {
1022+
// We allow same values for getters
1023+
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
1024+
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
10231025
return
10241026
}
10251027
/* eslint-enable no-self-compare */

dist/vue.runtime.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,9 @@
10251025
set: function reactiveSetter (newVal) {
10261026
var value = getter ? getter.call(obj) : val;
10271027
/* eslint-disable no-self-compare */
1028-
if (newVal === value || (newVal !== newVal && value !== value)) {
1028+
// We allow same values for getters
1029+
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
1030+
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
10291031
return
10301032
}
10311033
/* eslint-enable no-self-compare */

dist/vue.runtime.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vue-server-renderer/basic.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,9 @@
11531153
set: function reactiveSetter (newVal) {
11541154
var value = getter ? getter.call(obj) : val;
11551155
/* eslint-disable no-self-compare */
1156-
if (newVal === value || (newVal !== newVal && value !== value)) {
1156+
// We allow same values for getters
1157+
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
1158+
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
11571159
return
11581160
}
11591161
/* eslint-enable no-self-compare */

packages/vue-server-renderer/build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,9 @@ function defineReactive$$1 (
11611161
set: function reactiveSetter (newVal) {
11621162
var value = getter ? getter.call(obj) : val;
11631163
/* eslint-disable no-self-compare */
1164-
if (newVal === value || (newVal !== newVal && value !== value)) {
1164+
// We allow same values for getters
1165+
// See this: https://github.com/vuejs/vue/pull/7828#issuecomment-446820288
1166+
if ((newVal === value && !getter) || (newVal !== newVal && value !== value)) {
11651167
return
11661168
}
11671169
/* eslint-enable no-self-compare */

0 commit comments

Comments
 (0)