fix: library ids cross-contamination on multiple insert (#6466)
This commit is contained in:
parent
034113772d
commit
e9064a4a87
@ -12,6 +12,7 @@ import { MIME_TYPES } from "../constants";
|
||||
import Spinner from "./Spinner";
|
||||
import LibraryMenuBrowseButton from "./LibraryMenuBrowseButton";
|
||||
import clsx from "clsx";
|
||||
import { duplicateElements } from "../element/newElement";
|
||||
|
||||
const CELLS_PER_ROW = 4;
|
||||
|
||||
@ -96,7 +97,14 @@ const LibraryMenuItems = ({
|
||||
} else {
|
||||
targetElements = libraryItems.filter((item) => item.id === id);
|
||||
}
|
||||
return targetElements;
|
||||
return targetElements.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
// duplicate each library item before inserting on canvas to confine
|
||||
// ids and bindings to each library item. See #6465
|
||||
elements: duplicateElements(item.elements),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const createLibraryItemCompo = (params: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user