[feat-75] added fix on rebasing 1

This commit is contained in:
silentrald
2024-10-09 01:32:38 +08:00
parent 20499b821e
commit 132394524e
3 changed files with 12 additions and 2 deletions
@@ -356,6 +356,9 @@ export class LocalMapsManagerService {
total: 0,
};
log.info("Import maps processing following zip files", zipPaths);
for (const zipPath of zipPaths) {
try {
const zip = await JSZip.loadAsync(await readFile(zipPath));
@@ -425,6 +428,8 @@ export class LocalMapsManagerService {
observer.next(progress);
}
}
log.info("Import maps done");
} catch (error: any) {
log.error(`Could not import "${zipInfo.path}"`, error);
progress.data = undefined;
@@ -104,11 +104,12 @@ export function MapsPlaylistsPanel({ version, isActive }: Props) {
return playlistsManager.unlinkVersion(version);
}
const zipMimeTypes = ["application/zip", "application/zip-compressed", "application/x-zip-compressed"];
const handleFileDrop = async (files: FileList) => {
const paths: string[] = [];
for (let i = 0; i < files.length; ++i) {
const file = files[i];
if (file.type === "application/zip") {
if (zipMimeTypes.includes(file.type)) {
paths.push(file.path);
}
}
@@ -128,8 +128,12 @@ export const LocalMapsListPanel = forwardRef<LocalMapsListPanelRef, Props>(({ ve
return;
}
const mapsCopy = maps ? [ ...maps ] : [];
if (!maps$.value) {
setMaps(importMaps);
return;
}
const mapsCopy = [ ...maps$.value ];
for (const importMap of importMaps) {
const index = mapsCopy.findIndex(map => map.hash === importMap.hash);
if (index > -1) {