fix: stop using structuredClone (#9128)

fix: stop using `structuredClone`
pull/9106/merge
David Luzar 2 weeks ago committed by GitHub
parent e3060dfb8f
commit 26f02bebea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -104,7 +104,7 @@ const handleSegmentRenormalization = (
elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap,
) => { ) => {
const nextFixedSegments: FixedSegment[] | null = arrow.fixedSegments const nextFixedSegments: FixedSegment[] | null = arrow.fixedSegments
? structuredClone(arrow.fixedSegments) ? arrow.fixedSegments.slice()
: null; : null;
if (nextFixedSegments) { if (nextFixedSegments) {
@ -270,7 +270,7 @@ const handleSegmentRenormalization = (
const handleSegmentRelease = ( const handleSegmentRelease = (
arrow: ExcalidrawElbowArrowElement, arrow: ExcalidrawElbowArrowElement,
fixedSegments: FixedSegment[], fixedSegments: readonly FixedSegment[],
elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap,
) => { ) => {
const newFixedSegmentIndices = fixedSegments.map((segment) => segment.index); const newFixedSegmentIndices = fixedSegments.map((segment) => segment.index);
@ -444,7 +444,7 @@ const handleSegmentRelease = (
*/ */
const handleSegmentMove = ( const handleSegmentMove = (
arrow: ExcalidrawElbowArrowElement, arrow: ExcalidrawElbowArrowElement,
fixedSegments: FixedSegment[], fixedSegments: readonly FixedSegment[],
startHeading: Heading, startHeading: Heading,
endHeading: Heading, endHeading: Heading,
hoveredStartElement: ExcalidrawBindableElement | null, hoveredStartElement: ExcalidrawBindableElement | null,
@ -686,7 +686,7 @@ const handleSegmentMove = (
const handleEndpointDrag = ( const handleEndpointDrag = (
arrow: ExcalidrawElbowArrowElement, arrow: ExcalidrawElbowArrowElement,
updatedPoints: readonly LocalPoint[], updatedPoints: readonly LocalPoint[],
fixedSegments: FixedSegment[], fixedSegments: readonly FixedSegment[],
startHeading: Heading, startHeading: Heading,
endHeading: Heading, endHeading: Heading,
startGlobalPoint: GlobalPoint, startGlobalPoint: GlobalPoint,
@ -944,8 +944,8 @@ export const updateElbowArrowPoints = (
? updates.points![1] ? updates.points![1]
: p, : p,
) )
: structuredClone(updates.points) : updates.points.slice()
: structuredClone(arrow.points); : arrow.points.slice();
const { const {
startHeading, startHeading,
@ -1965,7 +1965,7 @@ const getBindableElementForId = (
const normalizeArrowElementUpdate = ( const normalizeArrowElementUpdate = (
global: GlobalPoint[], global: GlobalPoint[],
nextFixedSegments: FixedSegment[] | null, nextFixedSegments: readonly FixedSegment[] | null,
startIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"], startIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"],
endIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"], endIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"],
): { ): {
@ -1974,7 +1974,7 @@ const normalizeArrowElementUpdate = (
y: number; y: number;
width: number; width: number;
height: number; height: number;
fixedSegments: FixedSegment[] | null; fixedSegments: readonly FixedSegment[] | null;
startIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"]; startIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"];
endIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"]; endIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"];
} => { } => {

@ -337,7 +337,7 @@ export type ExcalidrawElbowArrowElement = Merge<
elbowed: true; elbowed: true;
startBinding: FixedPointBinding | null; startBinding: FixedPointBinding | null;
endBinding: FixedPointBinding | null; endBinding: FixedPointBinding | null;
fixedSegments: FixedSegment[] | null; fixedSegments: readonly FixedSegment[] | null;
/** /**
* Marks that the 3rd point should be used as the 2nd point of the arrow in * Marks that the 3rd point should be used as the 2nd point of the arrow in
* order to temporarily hide the first segment of the arrow without losing * order to temporarily hide the first segment of the arrow without losing

Loading…
Cancel
Save