mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: ability to debug the state of fractional indices (#8235)
This commit is contained in:
parent
7b36de0476
commit
d0a380758e
5 changed files with 122 additions and 10 deletions
|
@ -274,9 +274,17 @@ class Scene {
|
|||
: Array.from(nextElements.values());
|
||||
const nextFrameLikes: ExcalidrawFrameLikeElement[] = [];
|
||||
|
||||
if (import.meta.env.DEV || import.meta.env.MODE === ENV.TEST) {
|
||||
// throw on invalid indices in test / dev to potentially detect cases were we forgot to sync moved elements
|
||||
validateFractionalIndices(_nextElements.map((x) => x.index));
|
||||
if (
|
||||
import.meta.env.DEV ||
|
||||
import.meta.env.MODE === ENV.TEST ||
|
||||
window?.DEBUG_FRACTIONAL_INDICES
|
||||
) {
|
||||
validateFractionalIndices(_nextElements, {
|
||||
// validate everything
|
||||
includeBoundTextValidation: true,
|
||||
// throw only in dev & test, to remain functional on `DEBUG_FRACTIONAL_INDICES`
|
||||
shouldThrow: import.meta.env.DEV || import.meta.env.MODE === ENV.TEST,
|
||||
});
|
||||
}
|
||||
|
||||
this.elements = syncInvalidIndices(_nextElements);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue