From 803842d579fcdc26b4c999880d44d17ce9251057 Mon Sep 17 00:00:00 2001 From: silentrald Date: Wed, 2 Oct 2024 09:54:43 +0800 Subject: [PATCH] [feat-75] use map hash for comparing --- .../maps/local-maps-list-panel.component.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/maps-playlists-panel/maps/local-maps-list-panel.component.tsx b/src/renderer/components/maps-playlists-panel/maps/local-maps-list-panel.component.tsx index 5d361e39..dcc9d0ae 100644 --- a/src/renderer/components/maps-playlists-panel/maps/local-maps-list-panel.component.tsx +++ b/src/renderer/components/maps-playlists-panel/maps/local-maps-list-panel.component.tsx @@ -131,12 +131,9 @@ export const LocalMapsListPanel = forwardRef(({ ve const mapsCopy = maps ? [ ...maps ] : []; for (const importMap of importMaps) { - if (importMap.songDetails) { - // importMap can collide with existing map - const index = maps.findIndex(map => map.songDetails?.name === importMap.songDetails.name); - if (index > -1) { - mapsCopy.splice(index, 1); - } + const index = mapsCopy.findIndex(map => map.hash === importMap.hash); + if (index > -1) { + mapsCopy.splice(index, 1); } }