Dash Cytoscape Fails To Load After App Reboot

I’ve recently started dash cytoscape and it is amazing! However, I’m running into a consistent problem. After rebooting the app, whether it be on localHost or on a 5 worker gunicorn deployed app the cytoscape js fails to load on the first attempt. The page must be reloaded to get cytoscape to load. With 5 workers that means hitting refresh a lot to get everything “primed” for other users. After cytoscape loads it seems to be good to go on subsequent visits to the page. Is there something I can do to prevent this behavior?

Dash Cytoscape Fails to Load After App Reboot

Server error is mentioning that dash_cytoscape is not a registered library.

If anyone runs across this thread in the future I was able to fix this issue by ensuring the main app layout included a hidden dummy cytoscape element. This registers cytoscape when the app loads and resolves the errors. I was not loading cytoscape at the time the parent flask app started; it was only called after the user selected an endpoint which included cytoscape outputs. I put dummy cytoscape elements in each of my app factory registered dash app primary layouts and it solved the issue 100%.

1 Like