You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
elk.terminateWorker() will not error if the worker is not defined (Not sure of the circumstances if this).
Screenshots
If applicable, add screenshots to help explain your problem.
ELK Version
0.8.2
Additional context
I want to terminate the layout rendering if the graph changes again before the rendering is complete. I'm not 100% sure that calling terminateWorker will not create a
useEffect(() => {
const elk = new ELK({
workerUrl: webWorkerUrl,
});
elk
.layout(elkInput)
.then((elkOutput) => {
// ...consume the elkOutput
})
.catch((err) => {
throw new Error(err);
});
// Cancel the current job when input changes.
return elk.terminateWorker; // <-- HERE
}, [elkInput, webWorkerUrl]);
Workaround
// Cancel the current job when input changes.
return () => {
// @ts-expect-error function is not documented
if (elk.worker) elk.terminateWorker();
};
The text was updated successfully, but these errors were encountered:
terminateWorker
is documented in the README, but not included in the types. It can also error if the worker is not currently defined.Expected behavior
elk.terminateWorker()
is a documented in typeselk.terminateWorker()
will not error if the worker is not defined (Not sure of the circumstances if this).Screenshots
If applicable, add screenshots to help explain your problem.
ELK Version
0.8.2
Additional context
I want to terminate the layout rendering if the graph changes again before the rendering is complete. I'm not 100% sure that calling terminateWorker will not create a
Workaround
The text was updated successfully, but these errors were encountered: