feat: Replace Vue.delete with native alternative (no-changelog) (#6444)

* feat: replace Vue.delete with native alternative (no-changelog)

* fix: fix linting issues
This commit is contained in:
Alex Grozav
2023-06-15 18:27:35 +03:00
committed by GitHub
parent 1dbca44025
commit 618b1aba30
6 changed files with 48 additions and 22 deletions

View File

@@ -282,7 +282,7 @@
</template>
<script lang="ts">
import Vue, { defineComponent } from 'vue';
import { defineComponent } from 'vue';
import { mapStores } from 'pinia';
import ExecutionTime from '@/components/ExecutionTime.vue';
import ExecutionFilter from '@/components/ExecutionFilter.vue';
@@ -439,7 +439,9 @@ export default defineComponent({
},
handleCheckboxChanged(executionId: string) {
if (this.selectedItems[executionId]) {
Vue.delete(this.selectedItems, executionId);
const { [executionId]: removedSelectedItem, ...remainingSelectedItems } =
this.selectedItems;
this.selectedItems = remainingSelectedItems;
} else {
this.selectedItems = {
...this.selectedItems,

View File

@@ -158,7 +158,7 @@
<script lang="ts">
import type { PropType } from 'vue';
import Vue, { defineComponent } from 'vue';
import { defineComponent } from 'vue';
import { mapStores } from 'pinia';
import type {
INodeTypeDescription,
@@ -529,8 +529,8 @@ export default defineComponent({
// Data is on top level
if (value === null) {
// Property should be deleted
// @ts-ignore
Vue.delete(this.nodeValues, lastNamePart);
const { [lastNamePart]: removedNodeValue, ...remainingNodeValues } = this.nodeValues;
this.nodeValues = remainingNodeValues;
} else {
// Value should be set
this.nodeValues = {
@@ -542,18 +542,21 @@ export default defineComponent({
// Data is on lower level
if (value === null) {
// Property should be deleted
// @ts-ignore
let tempValue = get(this.nodeValues, nameParts.join('.')) as
| INodeParameters
| INodeParameters[];
Vue.delete(tempValue as object, lastNamePart as string);
const { [lastNamePart]: removedNodeValue, ...remainingNodeValues } = tempValue;
tempValue = remainingNodeValues;
if (isArray === true && (tempValue as INodeParameters[]).length === 0) {
// If a value from an array got delete and no values are left
// delete also the parent
lastNamePart = nameParts.pop();
tempValue = get(this.nodeValues, nameParts.join('.')) as INodeParameters;
Vue.delete(tempValue as object, lastNamePart as string);
const { [lastNamePart]: removedArrayNodeValue, ...remainingArrayNodeValues } =
tempValue;
tempValue = remainingArrayNodeValues;
}
} else {
// Value should be set