From 82ab38af09a61b0a501ca71461fdd6ff37f68a32 Mon Sep 17 00:00:00 2001 From: lovegaoshi <106490582+lovegaoshi@users.noreply.github.com> Date: Wed, 27 Nov 2024 04:47:29 -0800 Subject: [PATCH] fix: nox import --- src/components/setting/SyncSettings.tsx | 5 ++++- src/components/setting/sync/useSync.ts | 8 +++++++- src/utils/ChromeStorage.ts | 9 +++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/components/setting/SyncSettings.tsx b/src/components/setting/SyncSettings.tsx index 118d6dea3..21f557221 100644 --- a/src/components/setting/SyncSettings.tsx +++ b/src/components/setting/SyncSettings.tsx @@ -122,7 +122,10 @@ export default () => { title={t('Sync.SyncCheck')} options={noxExtensionContent} onClose={() => setSyncCheckVisible(false)} - onSubmit={syncPartialNoxExtension} + onSubmit={i => { + syncPartialNoxExtension(i); + setSyncCheckVisible(false); + }} /> ); diff --git a/src/components/setting/sync/useSync.ts b/src/components/setting/sync/useSync.ts index acf3845a9..bafe26483 100644 --- a/src/components/setting/sync/useSync.ts +++ b/src/components/setting/sync/useSync.ts @@ -72,7 +72,13 @@ const useSync = () => { const checkedPlaylists = checkedPlaylistIndexes .map((val, index) => val - ? cachedParsedContent[cachedParsedContent.MyFavList[index]] + ? { + ...cachedParsedContent[cachedParsedContent.MyFavList[index]], + songList: + cachedParsedContent[ + `${cachedParsedContent.MyFavList[index]}-songList` + ], + } : undefined, ) .filter(val => val); diff --git a/src/utils/ChromeStorage.ts b/src/utils/ChromeStorage.ts index 2ad572852..aab78365d 100644 --- a/src/utils/ChromeStorage.ts +++ b/src/utils/ChromeStorage.ts @@ -251,9 +251,10 @@ const saveImportedPlaylist = async (playlists: any[]) => { export const clearPlaylistNImport = async (parsedContent: any) => { await clearPlaylists(); await saveImportedPlaylist( - parsedContent[StorageKeys.MY_FAV_LIST_KEY].map( - (val: string) => parsedContent[val], - ), + parsedContent[StorageKeys.MY_FAV_LIST_KEY].map((val: string) => ({ + ...parsedContent[val], + songList: parsedContent[`${val}-songList`], + })), ); await savePlaylistIds(parsedContent[StorageKeys.MY_FAV_LIST_KEY]); }; @@ -262,7 +263,7 @@ export const addImportedPlaylist = async (playlists: any[]) => { await saveImportedPlaylist(playlists); await savePlaylistIds( (await getItem(StorageKeys.MY_FAV_LIST_KEY)).concat( - playlists.map(val => val.info.id), + playlists.map(val => val.id), ), ); };