fix: don't merge libraryItems on updateScene (#5076)

This commit is contained in:
Achille Lacoin 2022-04-21 10:54:02 +02:00 committed by GitHub
parent b5a46dd671
commit 86cf28f2b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,7 +77,7 @@ import {
} from "../constants";
import { loadFromBlob } from "../data";
import Library from "../data/library";
import { restore, restoreElements } from "../data/restore";
import { restore, restoreElements, restoreLibraryItems } from "../data/restore";
import {
dragNewElement,
dragSelectedElements,
@ -1692,7 +1692,20 @@ class App extends React.Component<AppProps, AppState> {
}
if (sceneData.libraryItems) {
this.library.importLibrary(sceneData.libraryItems, "unpublished");
this.library.saveLibrary(
new Promise<LibraryItems>(async (resolve, reject) => {
try {
resolve(
restoreLibraryItems(
await sceneData.libraryItems,
"unpublished",
),
);
} catch {
reject(new Error(t("errors.importLibraryError")));
}
}),
);
}
},
);