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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user