Skip to content

Commit

Permalink
fix(website): update config only on change
Browse files Browse the repository at this point in the history
  • Loading branch information
mytlogos committed Dec 11, 2021
1 parent 7086cd7 commit fbfc28f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/website/src/views/CustomHookView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import { defineComponent } from "@vue/runtime-core";
import { HookState } from "../siteTypes";
import { CustomHook } from "enterprise-core/dist/types";
import CustomHookForm from "../components/customHook/custom-hook-form.vue";
import { clone } from "../init";
import { clone, deepEqual, Logger } from "../init";
interface Data {
code: string;
Expand All @@ -115,6 +115,7 @@ interface Data {
value: Partial<HookConfig>;
hook: Partial<CustomHook>;
activeTab: "form" | "editor";
logger: Logger;
}
interface BasicSelector {
Expand All @@ -136,6 +137,7 @@ export default defineComponent({
data(): Data {
return {
loading: false,
logger: new Logger("CustomHookView"),
code: "",
invalid: "",
param: "",
Expand Down Expand Up @@ -175,7 +177,11 @@ export default defineComponent({
},
methods: {
setConfig(value: Partial<HookConfig>) {
console.log("CustomHookView: Updating HookConfig");
if (deepEqual(value, this.value)) {
this.logger.info("No config update required");
return;
}
this.logger.info("Updated HookConfig");
this.value = value;
},
validateSelector<T extends BasicSelector>(value: T) {
Expand Down

0 comments on commit fbfc28f

Please sign in to comment.