From d014cb2741ddae7e4827f5ede38a1fcb39755d92 Mon Sep 17 00:00:00 2001 From: Nico Hoffmann Date: Thu, 27 Oct 2022 14:34:06 +0700 Subject: [PATCH 01/62] `content` store: use new `set()`, `del()` methods --- panel/src/store/modules/content.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/panel/src/store/modules/content.js b/panel/src/store/modules/content.js index ba9da00e18..6c38d019db 100644 --- a/panel/src/store/modules/content.js +++ b/panel/src/store/modules/content.js @@ -1,4 +1,4 @@ -import Vue from "vue"; +import Vue, { set, del } from "vue"; import { clone } from "@/helpers/object.js"; const keep = (id, data) => { @@ -129,7 +129,7 @@ export default { // otherwise fallback to provided changes let changes = state.models[id] ? state.models[id].changes : model.changes; - Vue.set(state.models, id, { + set(state.models, id, { api: model.api, originals: model.originals, changes: changes || {} @@ -141,8 +141,8 @@ export default { MOVE(state, [from, to]) { // move state const model = clone(state.models[from]); - Vue.delete(state.models, from); - Vue.set(state.models, to, model); + del(state.models, from); + set(state.models, to, model); // move local storage const storage = localStorage.getItem("kirby$content$" + from); @@ -150,17 +150,17 @@ export default { localStorage.setItem("kirby$content$" + to, storage); }, REMOVE(state, id) { - Vue.delete(state.models, id); + del(state.models, id); localStorage.removeItem("kirby$content$" + id); }, REVERT(state, id) { if (state.models[id]) { - Vue.set(state.models[id], "changes", {}); + set(state.models[id], "changes", {}); localStorage.removeItem("kirby$content$" + id); } }, STATUS(state, enabled) { - Vue.set(state.status, "enabled", enabled); + set(state.status, "enabled", enabled); }, UPDATE(state, [id, field, value]) { // avoid updating without a valid model @@ -181,10 +181,10 @@ export default { if (original == current) { // if the same, there are no unsaved changes - Vue.delete(state.models[id].changes, field); + del(state.models[id].changes, field); } else { // if they differ, set as unsaved change - Vue.set(state.models[id].changes, field, value); + set(state.models[id].changes, field, value); } keep(id, { From 83e69e751c94245f8a64871199447b710478d829 Mon Sep 17 00:00:00 2001 From: Nico Hoffmann Date: Thu, 27 Oct 2022 15:02:51 +0700 Subject: [PATCH 02/62] Remove `this.$set`, `this.$delete` --- panel/src/components/Forms/Blocks/Blocks.vue | 11 ++++++----- panel/src/components/Forms/Field/ObjectField.vue | 3 ++- panel/src/components/Forms/FormButtons.vue | 4 +++- panel/src/mixins/picker/dialog.js | 7 +++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/panel/src/components/Forms/Blocks/Blocks.vue b/panel/src/components/Forms/Blocks/Blocks.vue index 9bbfe298e1..4edd2c5d8d 100644 --- a/panel/src/components/Forms/Blocks/Blocks.vue +++ b/panel/src/components/Forms/Blocks/Blocks.vue @@ -84,6 +84,7 @@