chore: Defer elk loading

This commit is contained in:
Sidharth Vinod 2023-02-16 12:47:28 +05:30
parent 8df965bd60
commit 037504785c
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
1 changed files with 5 additions and 2 deletions

View File

@ -9,9 +9,9 @@ import { log } from '../../../logger';
import { setupGraphViewbox } from '../../../setupGraphViewbox'; import { setupGraphViewbox } from '../../../setupGraphViewbox';
import common, { evaluate } from '../../common/common'; import common, { evaluate } from '../../common/common';
import { interpolateToCurve, getStylesFromArray } from '../../../utils'; import { interpolateToCurve, getStylesFromArray } from '../../../utils';
import ELK from 'elkjs';
import ELK from 'elkjs/lib/elk.bundled.js'; let elk;
const elk = new ELK();
const portPos = {}; const portPos = {};
@ -766,6 +766,9 @@ const insertChildren = (nodeArray, parentLookupDb) => {
*/ */
export const draw = async function (text, id, _version, diagObj) { export const draw = async function (text, id, _version, diagObj) {
if (!elk) {
elk = new ELK();
}
// Add temporary render element // Add temporary render element
diagObj.db.clear(); diagObj.db.clear();
nodeDb = {}; nodeDb = {};