Skip to content

Commit 23a66d1

Browse files
fix: adiciona verificação adicional do valor do model e internal para evitar loop
1 parent 31cc1ed commit 23a66d1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/Select.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ watch(() => props.options, (newValue, oldValue) => {
332332
}, { immediate: true });
333333
334334
watch(model, (newValue, oldValue) => {
335-
if (newValue !== oldValue) {
335+
if (newValue !== oldValue && newValue !== localValue.value) {
336336
if (newValue instanceof Object) {
337337
localValue.value = newValue;
338338
} else {
@@ -342,6 +342,8 @@ watch(model, (newValue, oldValue) => {
342342
}, { immediate: true });
343343
344344
watch(localValue, (currentValue) => {
345+
if (currentValue === model.value) return;
346+
345347
const compatibleOptions = localOptions.value.filter(
346348
(option) => JSON.stringify(option) === JSON.stringify(currentValue),
347349
);

0 commit comments

Comments
 (0)