Skip to content

Commit

Permalink
Fix infinite loop in vue2
Browse files Browse the repository at this point in the history
  • Loading branch information
dk981234 committed Oct 7, 2024
1 parent 841f497 commit f4ad70a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/vue/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ export class BaseVue extends Vue {
}
protected onMounted() { }
protected onUpdated() { }
protected onBeforeUpdated() {}
protected onDestroyed() { }
protected onCreated() {
protected onCreated() {}
created() {
var model = this.getModel();
if (!model) return;
model.iteratePropertiesHash((propertiesHash: any, name: any) => {
Expand All @@ -41,15 +43,14 @@ export class BaseVue extends Vue {
Vue.set(propertiesHash, name, val);
else propertiesHash[name] = val;
};
}
created() {
this.onCreated();
}
beforeMount() {
this.setIsRendering(true);
}
beforeUpdate() {
this.setIsRendering(true);
this.onBeforeUpdated();
}
mounted() {
this.setIsRendering(false);
Expand Down
21 changes: 12 additions & 9 deletions src/vue/components/dropdown/dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,8 @@ export class DropdownComponent extends BaseVue {
inputChange(event: any) {
this.model.inputStringRendered = event.target.value;
}
public get showSelectedItemLocText() {
return this.question.showSelectedItemLocText;
}
public get selectedItemLocText() {
return this.question.selectedItemLocText;
}
showSelectedItemLocText: any = null;
selectedItemLocText: any = false;
public click(event: any) {
this.model?.onClick(event);
Expand Down Expand Up @@ -175,8 +169,17 @@ export class DropdownComponent extends BaseVue {
}
}
}
private updateSelectedItemProperties() {
this.showSelectedItemLocText = this.question.showSelectedItemLocText;
this.selectedItemLocText = this.question.selectedItemLocText;
}
onCreated(): void {
this.updateSelectedItemProperties();
}
onBeforeUpdated(): void {
this.updateSelectedItemProperties();
}
}
Vue.component("sv-dropdown", DropdownComponent);
export default DropdownComponent;
</script>

0 comments on commit f4ad70a

Please sign in to comment.