Skip to content

Commit

Permalink
Merge pull request #5486 from i7slegend/fix/5412-twice-render
Browse files Browse the repository at this point in the history
Fix #5412 - Twice render if attribute id not defined
  • Loading branch information
tugcekucukoglu authored Apr 3, 2024
2 parents 0c44e20 + 85a9455 commit 52fc487
Show file tree
Hide file tree
Showing 30 changed files with 151 additions and 120 deletions.
10 changes: 5 additions & 5 deletions components/lib/accordion/Accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeIndex(newValue) {
this.d_activeIndex = newValue;
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
isAccordionTab(child) {
return child.type.name === 'AccordionTab';
Expand Down
8 changes: 5 additions & 3 deletions components/lib/autocomplete/AutoComplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
suggestions() {
if (this.searching) {
Expand All @@ -215,7 +218,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
},
updated() {
Expand Down
8 changes: 5 additions & 3 deletions components/lib/calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,11 @@ export default {
};
},
watch: {
id: function (newValue) {
this.d_id = newValue || UniqueComponentId();
id: {
immediate: true,
handler: function (newValue) {
this.d_id = newValue || UniqueComponentId();
}
},
modelValue(newValue) {
this.updateCurrentMetaData();
Expand Down Expand Up @@ -611,7 +614,6 @@ export default {
this.updateCurrentMetaData();
},
mounted() {
this.d_id = this.d_id || UniqueComponentId();
this.createResponsiveStyle();
this.bindMatchMediaListener();
Expand Down
8 changes: 5 additions & 3 deletions components/lib/cascadeselect/CascadeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,17 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
options() {
this.autoUpdateModel();
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
},
beforeUnmount() {
Expand Down
10 changes: 5 additions & 5 deletions components/lib/chips/Chips.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
onWrapperClick() {
this.$refs.input.focus();
Expand Down
9 changes: 5 additions & 4 deletions components/lib/contextmenu/ContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeItemPath(newPath) {
if (ObjectUtils.isNotEmpty(newPath)) {
Expand All @@ -78,8 +81,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.global) {
this.bindDocumentContextMenuListener();
}
Expand Down
9 changes: 5 additions & 4 deletions components/lib/datatable/ColumnFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
overlay: null,
Expand All @@ -305,8 +308,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.filters && this.filters[this.field]) {
let fieldFilters = this.filters[this.field];
Expand Down
9 changes: 5 additions & 4 deletions components/lib/dialog/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
documentKeydownListener: null,
Expand Down Expand Up @@ -124,8 +127,6 @@ export default {
this.mask = null;
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.breakpoints) {
this.createStyle();
}
Expand Down
10 changes: 5 additions & 5 deletions components/lib/dock/DockSub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ export default {
};
},
watch: {
menuId(newValue) {
this.id = newValue || UniqueComponentId();
menuId: {
immediate: true,
handler(newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
getItemId(index) {
return `${this.id}_${index}`;
Expand Down
8 changes: 5 additions & 3 deletions components/lib/dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
modelValue() {
this.isModelValueChanged = true;
Expand All @@ -229,7 +232,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
this.bindLabelClickListener();
},
Expand Down
10 changes: 5 additions & 5 deletions components/lib/fieldset/Fieldset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
collapsed(newValue) {
this.d_collapsed = newValue;
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
toggle(event) {
this.d_collapsed = !this.d_collapsed;
Expand Down
12 changes: 6 additions & 6 deletions components/lib/galleria/GalleriaContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,18 @@ export default {
emits: ['activeitem-change', 'mask-hide'],
data() {
return {
id: this.$attrs.id || UniqueComponentId(),
id: this.$attrs.id,
activeIndex: this.$attrs.activeIndex,
numVisible: this.$attrs.numVisible,
slideShowActive: false
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
'$attrs.value': function (newVal) {
if (newVal && newVal.length < this.numVisible) {
Expand All @@ -101,9 +104,6 @@ export default {
newVal ? this.startSlideShow() : this.stopSlideShow();
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
updated() {
this.$emit('activeitem-change', this.activeIndex);
},
Expand Down
8 changes: 5 additions & 3 deletions components/lib/listbox/Listbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,17 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
options() {
this.autoUpdateModel();
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
},
methods: {
Expand Down
8 changes: 5 additions & 3 deletions components/lib/megamenu/MegaMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeItem(newItem) {
if (ObjectUtils.isNotEmpty(newItem)) {
Expand All @@ -100,7 +103,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.bindMatchMediaListener();
},
beforeUnmount() {
Expand Down
9 changes: 5 additions & 4 deletions components/lib/menu/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
target: null,
Expand All @@ -83,8 +86,6 @@ export default {
container: null,
list: null,
mounted() {
this.id = this.id || UniqueComponentId();
if (!this.popup) {
this.bindResizeListener();
this.bindOutsideClickListener();
Expand Down
8 changes: 5 additions & 3 deletions components/lib/menubar/Menubar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeItemPath(newPath) {
if (ObjectUtils.isNotEmpty(newPath)) {
Expand All @@ -96,7 +99,6 @@ export default {
container: null,
menubar: null,
mounted() {
this.id = this.id || UniqueComponentId();
this.bindMatchMediaListener();
},
beforeUnmount() {
Expand Down
8 changes: 5 additions & 3 deletions components/lib/multiselect/MultiSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,17 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
options() {
this.autoUpdateModel();
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
},
beforeUnmount() {
Expand Down
Loading

0 comments on commit 52fc487

Please sign in to comment.