Skip to content

Commit

Permalink
clone on export
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelle committed Nov 12, 2023
1 parent a0e3b84 commit b209e9f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/scene/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
getElementAbsoluteCoords,
} from "../element/bounds";
import { renderStaticScene, renderSceneToSvg } from "../renderer/renderScene";
import { distance, getFontString } from "../utils";
import { cloneJSON, distance, getFontString } from "../utils";
import { AppState, BinaryFiles } from "../types";
import {
DEFAULT_BACKGROUND_COLOR,
Expand Down Expand Up @@ -57,8 +57,9 @@ const __createSceneForElementsHack__ = (
// we can't duplicate elements to regenerate ids because we need the
// orig ids when embedding. So we do another hack of not mapping element
// ids to Scene instances so that we don't override the editor elements
// mapping
scene.replaceAllElements(elements, false);
// mapping.
// We still need to clone the objects themselves to regen references.
scene.replaceAllElements(cloneJSON(elements), false);
return scene;
};

Expand Down

0 comments on commit b209e9f

Please sign in to comment.