Closed Leviash closed 1 year ago
With the improved code, the performance does not degrade for multiple toggle. This tip about setTimeout
and requestAnimationFrame
has nothing to do with performance, except that multiple instances were created and not destroyed earlier.
case
I have multiple types of data and I need to re-render the force-directed map when switching data.
Error in browser developer tools
I don’t know how to turn off the previously enabled setTimeout and requestAnimationFrame. The more times the data is switched, the more laggy it becomes. So now, as a workaround, I pass
null
to the previous graph to avoid performance issues. However, this leads to errors likeCannot read properties of null (reading ‘nodes’)
andCannot read properties of null (reading ‘links’)
, and it doesn’t provide a real solution. Therefore, I would like to ask how to completely solve this problem?Improving the code
I changed the code so that
Cannot read properties of null (reading ‘nodes’)
andCannot read properties of null (reading ‘links’)
no longer give errors. But the problem ofsetTimeout
andrequestAnimationFrame
remains.