From 86cf28f2b493b99eb8b1220cd3bcc1daacf000cc Mon Sep 17 00:00:00 2001 From: Achille Lacoin Date: Thu, 21 Apr 2022 10:54:02 +0200 Subject: [PATCH] fix: don't merge libraryItems on updateScene (#5076) --- src/components/App.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index d542c3a4..38520fc4 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -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 { } if (sceneData.libraryItems) { - this.library.importLibrary(sceneData.libraryItems, "unpublished"); + this.library.saveLibrary( + new Promise(async (resolve, reject) => { + try { + resolve( + restoreLibraryItems( + await sceneData.libraryItems, + "unpublished", + ), + ); + } catch { + reject(new Error(t("errors.importLibraryError"))); + } + }), + ); } }, );