Replace cloneDeep to native structuredclone and remove unused import

This commit is contained in:
kwaroran
2024-04-25 01:17:14 +09:00
parent cc744853d2
commit 11b1d4d4f3
22 changed files with 85 additions and 115 deletions

View File

@@ -5,8 +5,7 @@ import { forageStorage, getUnpargeables, isNodeServer, isTauri, openURL } from "
import { BaseDirectory, exists, readBinaryFile, readDir, writeBinaryFile } from "@tauri-apps/api/fs";
import { language } from "../../lang";
import { relaunch } from '@tauri-apps/api/process';
import { open } from '@tauri-apps/api/shell';
import { cloneDeep, isEqual, last } from "lodash";
import { isEqual } from "lodash";
import { sleep } from "../util";
import { hubURL } from "../characterCards";
import { decodeRisuSave, encodeRisuSave } from "../storage/risuSave";
@@ -108,7 +107,7 @@ let BackupDb:Database = null
export async function syncDrive() {
BackupDb = cloneDeep(get(DataBase))
BackupDb = structuredClone(get(DataBase))
return
while(true){
const maindb = get(DataBase)
@@ -136,7 +135,7 @@ export async function syncDrive() {
localStorage.setItem('risu_lastsaved', `${lastSaved}`)
const hadNoSync = d === 'noSync'
if((!isEqual(maindb, BackupDb)) || hadNoSync){
BackupDb = cloneDeep(maindb)
BackupDb = structuredClone(maindb)
const files:DriveFile[] = await getFilesInFolder(ACCESS_TOKEN)
const fileNames = files.map((d) => {
return d.name