Skip to content

Commit

Permalink
Do not proxy propertiesHash object
Browse files Browse the repository at this point in the history
  • Loading branch information
dk981234 committed Mar 15, 2023
1 parent 9db854a commit 4d6a718
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 4 additions & 2 deletions packages/survey-vue-ui/src/Survey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
</template>

<script lang="ts">
import { Base, StylesManager, surveyCss, SvgRegistry, SurveyModel, doKey2ClickUp, IAttachKey2clickOptions } from "survey-core";
import { SvgRegistry, SurveyModel } from "survey-core";
import { reactive, isReactive } from "vue";
import { defineSurveyComponent } from "./base";
export default defineSurveyComponent({
Expand Down Expand Up @@ -129,7 +130,8 @@ export default defineSurveyComponent({
},
computed: {
vueSurvey(): SurveyModel {
return !!this.survey ? this.survey : this.model;
const survey = !!this.survey ? this.survey : this.model;
return isReactive(survey) ? survey : reactive(survey);
},
pageId: {
get() {
Expand Down
17 changes: 14 additions & 3 deletions packages/survey-vue-ui/src/base.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import type { Base } from "survey-core";
import { ref, defineComponent, type ComponentOptions, unref, isRef } from "vue";

import { Base } from "survey-core";
import {
ref,
defineComponent,
type ComponentOptions,
unref,
isRef,
markRaw,
} from "vue";
Base.createPropertiesHash = () => {
const res = {};
markRaw(res);
return res;
};
function makeReactive(surveyElement: Base) {
surveyElement.iteratePropertiesHash((propertiesHash: any, name: any) => {
// (<any>Vue.util).defineReactive(propertiesHash, name, propertiesHash[name]);
Expand Down
5 changes: 4 additions & 1 deletion src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,11 @@ export class Base {
protected isPropertyEmpty(value: any): boolean {
return value !== "" && this.isValueEmpty(value);
}
public static createPropertiesHash() {
return {};
}

private propertyHash: { [index: string]: any } = {};
private propertyHash: { [index: string]: any } = Base.createPropertiesHash();
private localizableStrings: { [index: string]: LocalizableString };
private arraysInfo: { [index: string]: any };
private eventList: Array<EventBase<any>> = [];
Expand Down

0 comments on commit 4d6a718

Please sign in to comment.