layout failed Error: Failed to execute 'postMessage' on 'Worker' #4893
loveshiun posted onGitHub
Describe the bug
layout failed Error: Failed to execute 'postMessage' on 'Worker': function (e) {
obj[action](e);
} could not be cloned.
at LayoutController.runWebworker (https://4dmzm8.csb.app/node_modules/@antv/g6-pc/es/graph/controller/layout.js:432:14)
at eval (https://4dmzm8.csb.app/node_modules/@antv/g6-pc/es/graph/controller/layout.js:397:22)
Your Example Website or App
https://codesandbox.io/s/cocky-euler-4dmzm8?file=/index.js
Steps to Reproduce the Bug or Issue
Try to comment out the 3 lines after
console.log("try to update the graph");
(line: 182 in the example link)graph.data(newData); graph.render(); graph.updateItem(graph.getNodes()[0], config);
the graph works as expected.
Add back the 3 lines, the graph will not update.
Keep the 3 lines, but change
workerEnabled
from true to false, the graph will update normally again.Set
workerEnabled
to true again, but now add one more linegraph.render();
after the 3 lines, the graph will also update.
Besides, when workerEnabled
is true, some operations may result in layout failed Error: Failed to execute 'postMessage' on 'Worker'
.
Expected behavior
When workerEnabled: true
, should have nearly the same behavior as workerEnabled: false
?
Screenshots or Videos
No response
Platform
- OS: Linux
- Browser: Chrome (incognito)
- Version:
Additional context
No response
The example app is updated from https://codesandbox.io/s/0vg0cl