Skip to content

Commit

Permalink
Merge pull request #6479 from getkirby/v5/refactor/revert-helper-clon…
Browse files Browse the repository at this point in the history
…e-deprecated

Revert: deprecating `this.$helper.object.clone`
  • Loading branch information
bastianallgeier authored Jun 10, 2024
2 parents a792538 + 27b73ef commit 5f81c72
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 17 deletions.
10 changes: 5 additions & 5 deletions panel/lab/components/stats/1_stats/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ export default {
];
},
reportsWithoutTheme() {
return structuredClone(this.reports).map((report) => {
report.icon = null;
report.theme = null;
return report;
});
return this.reports.map((report) => ({
...report,
icon: null,
theme: null
}));
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions panel/src/components/Forms/Blocks/Blocks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export default {
},
async duplicate(block, index) {
const copy = {
...structuredClone(block),
...this.$helper.object.clone(block),
id: this.$helper.uuid()
};
this.blocks.splice(index + 1, 0, copy);
Expand Down Expand Up @@ -677,7 +677,7 @@ export default {
if (to < 0) {
return;
}
let blocks = structuredClone(this.blocks);
let blocks = this.$helper.object.clone(this.blocks);
blocks.splice(from, 1);
blocks.splice(to, 0, block);
this.blocks = blocks;
Expand All @@ -687,7 +687,7 @@ export default {
},
async split(block, index, contents) {
// prepare old block with reduced content chunk
const oldBlock = structuredClone(block);
const oldBlock = this.$helper.object.clone(block);
oldBlock.content = { ...oldBlock.content, ...contents[0] };
// create a new block and merge in default contents as
Expand Down
2 changes: 1 addition & 1 deletion panel/src/components/Forms/Field/StructureField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export default {
case "duplicate":
this.add({
...structuredClone(row),
...this.$helper.object.clone(row),
_id: this.$helper.uuid()
});
break;
Expand Down
4 changes: 2 additions & 2 deletions panel/src/components/Forms/Input/TagsInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default {
methods: {
create(input) {
const inputs = input.split(this.separator).map((tag) => tag.trim());
const tags = structuredClone(this.value);
const tags = this.$helper.object.clone(this.value);
for (let tag of inputs) {
// convert input to tag object
Expand Down Expand Up @@ -201,7 +201,7 @@ export default {
}
// replace the tag at the given index
const tags = structuredClone(this.value);
const tags = this.$helper.object.clone(this.value);
tags.splice(index, 1, updated.value);
this.$emit("input", tags);
Expand Down
4 changes: 2 additions & 2 deletions panel/src/components/Forms/Layouts/Layouts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default {
});
},
duplicate(index, layout) {
const copy = structuredClone(layout);
const copy = this.$helper.object.clone(layout);
// replace all unique IDs for layouts, columns and blocks
// the method processes a single object and returns it as an array
Expand Down Expand Up @@ -200,7 +200,7 @@ export default {
// move throught the new layout rows in steps of columns per row
for (let i = 0; i < chunks; i += newLayout.columns.length) {
const copy = {
...structuredClone(newLayout),
...this.$helper.object.clone(newLayout),
id: this.$helper.uuid()
};
Expand Down
2 changes: 1 addition & 1 deletion panel/src/components/Navigation/Tags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default {
handler() {
// make sure values are not reactive
// otherwise this could have nasty side-effects
let tags = structuredClone(this.value);
let tags = this.$helper.object.clone(this.value);
// sort all tags by the available options
if (this.sort === true) {
Expand Down
2 changes: 1 addition & 1 deletion panel/src/components/Views/System/SystemSecurity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default {
},
data() {
return {
issues: structuredClone(this.security)
issues: this.$helper.object.clone(this.security)
};
},
async mounted() {
Expand Down
2 changes: 0 additions & 2 deletions panel/src/helpers/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* @param {Object|array} value
* @returns {Object|array}
*
* @deprecated 4.1.0 Use `structuredClone` instead
*/
export function clone(value) {
if (value === undefined) {
Expand Down

0 comments on commit 5f81c72

Please sign in to comment.