mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
chore: Use isDevEnv() and isTestEnv() (#9264)
All checks were successful
Tests / test (push) Successful in 4m50s
All checks were successful
Tests / test (push) Successful in 4m50s
Signed-off-by: Mark Tolmacs <mark@lazycat.hu> Co-authored-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
parent
77aca48c84
commit
e1bb59fb8f
16 changed files with 48 additions and 45 deletions
|
@ -1,12 +1,11 @@
|
|||
import throttle from "lodash.throttle";
|
||||
|
||||
import { ENV } from "../constants";
|
||||
import {
|
||||
orderByFractionalIndex,
|
||||
syncInvalidIndices,
|
||||
validateFractionalIndices,
|
||||
} from "../fractionalIndex";
|
||||
import { arrayToMap } from "../utils";
|
||||
import { arrayToMap, isDevEnv, isTestEnv } from "../utils";
|
||||
|
||||
import type { OrderedExcalidrawElement } from "../element/types";
|
||||
import type { AppState } from "../types";
|
||||
|
@ -47,11 +46,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 })),
|
||||
|
@ -59,7 +54,7 @@ const validateIndicesThrottled = throttle(
|
|||
|
||||
validateFractionalIndices(elements, {
|
||||
// throw in dev & test only, to remain functional on `DEBUG_FRACTIONAL_INDICES`
|
||||
shouldThrow: import.meta.env.DEV || import.meta.env.MODE === ENV.TEST,
|
||||
shouldThrow: isTestEnv() || isDevEnv(),
|
||||
includeBoundTextValidation: true,
|
||||
reconciliationContext: {
|
||||
localElements,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue