chore: Use isDevEnv() and isTestEnv() (#9264)
Signed-off-by: Mark Tolmacs <mark@lazycat.hu> Co-authored-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import throttle from "lodash.throttle";
|
||||
|
||||
import { ENV } from "../constants";
|
||||
import { isNonDeletedElement } from "../element";
|
||||
import { isFrameLikeElement } from "../element/typeChecks";
|
||||
import {
|
||||
@@ -10,7 +9,7 @@ import {
|
||||
} from "../fractionalIndex";
|
||||
import { getElementsInGroup } from "../groups";
|
||||
import { randomInteger } from "../random";
|
||||
import { arrayToMap } from "../utils";
|
||||
import { arrayToMap, isDevEnv, isTestEnv } from "../utils";
|
||||
import { toBrandedType } from "../utils";
|
||||
|
||||
import { getSelectedElements } from "./selection";
|
||||
@@ -57,14 +56,10 @@ const getNonDeletedElements = <T extends ExcalidrawElement>(
|
||||
|
||||
const validateIndicesThrottled = throttle(
|
||||
(elements: readonly ExcalidrawElement[]) => {
|
||||
if (
|
||||
import.meta.env.DEV ||
|
||||
import.meta.env.MODE === ENV.TEST ||
|
||||
window?.DEBUG_FRACTIONAL_INDICES
|
||||
) {
|
||||
if (isDevEnv() || isTestEnv() || window?.DEBUG_FRACTIONAL_INDICES) {
|
||||
validateFractionalIndices(elements, {
|
||||
// throw only in dev & test, to remain functional on `DEBUG_FRACTIONAL_INDICES`
|
||||
shouldThrow: import.meta.env.DEV || import.meta.env.MODE === ENV.TEST,
|
||||
shouldThrow: isDevEnv() || isTestEnv(),
|
||||
includeBoundTextValidation: true,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user