Merge branch 'master' into mrazator/separate-element-into-standalone-package

This commit is contained in:
Marcel Mraz 2025-03-25 10:05:50 +01:00
commit e50f78e9d2
No known key found for this signature in database
GPG key ID: 4EBD6E62DC830CD2
15 changed files with 50 additions and 48 deletions

View file

@ -1,6 +1,6 @@
import throttle from "lodash.throttle";
import { ENV, arrayToMap } from "@excalidraw/common";
import { arrayToMap, isDevEnv, isTestEnv } from "@excalidraw/common";
import {
orderByFractionalIndex,
@ -49,11 +49,7 @@ const validateIndicesThrottled = throttle(
localElements: readonly OrderedExcalidrawElement[],
remoteElements: readonly RemoteExcalidrawElement[],
) => {
if (
import.meta.env.DEV ||
import.meta.env.MODE === ENV.TEST ||
window?.DEBUG_FRACTIONAL_INDICES
) {
if (isDevEnv() || isTestEnv() || window?.DEBUG_FRACTIONAL_INDICES) {
// create new instances due to the mutation
const elements = syncInvalidIndices(
orderedElements.map((x) => ({ ...x })),
@ -61,9 +57,7 @@ const validateIndicesThrottled = throttle(
validateFractionalIndices(elements, {
// throw in dev & test only, to remain functional on `DEBUG_FRACTIONAL_INDICES`
shouldThrow: Boolean(
import.meta.env.DEV || import.meta.env.MODE === ENV.TEST,
),
shouldThrow: isTestEnv() || isDevEnv(),
includeBoundTextValidation: true,
reconciliationContext: {
localElements,