Replace JSON.parse(JSON.stringify()) with lodash-es cloneDeep for deep cloning Vue reactive data (S7784)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 08:23:44 +08:00
parent 2374363484
commit e9e588385b
11 changed files with 76 additions and 56 deletions

View File

@@ -482,6 +482,7 @@ import {
reallyDeleteInformation,
} from "@/module/alertModal.js";
import { escapeHtml } from "@/utils/escapeHtml.js";
import { cloneDeep } from "lodash-es";
const router = useRouter();
@@ -586,7 +587,7 @@ const isCompareDisabledButton = computed(() => {
const reallyDeleteData = computed(() => {
let result = [];
if (store.allFiles.length !== 0) {
result = JSON.parse(JSON.stringify(store.allFiles));
result = cloneDeep(store.allFiles);
result = result.filter((file) => file.is_deleted === true);
}
return result;
@@ -602,7 +603,7 @@ watch(filesTag, (newValue) => {
watch(allFiles, (newValue) => {
if (newValue !== null)
compareData.value = JSON.parse(JSON.stringify(newValue));
compareData.value = cloneDeep(newValue);
});
watch(