Draw.io editor embedding fails with "not fast enough" internet connection

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

Draw.io editor embedding, for instance in the wiki editor, fails if user does not have a fast-enough internet connection. This seems to be due to a 4 seconds loading timeout, too low for fetching many megabytes of JS.

Steps to reproduce

In Firefox (but something similar can certainly be done in Chrome or other browsers):

  • clear diagrams.net resources from your browser cache:
    • open a tab on (for instance) https://embed.diagrams.net/js/PreConfig.js, to have the domain at the top of your navigation history
    • in your navigation history, right click this diagrams.net item, and Forget About This Site...
  • navigate to a GitLab.com wiki page Edit action
  • open Firefox development tools
  • select DSL like throttling (top-right of the dev tools UI, default is No Throttling); that's roughly a 2 Mbps download bandwidth
  • in the wiki editor, click the draw.io icon ("Insert or edit diagram")
  • observe no draw.io editor opens, and instead you get an error message: "The diagrams.net editor could not be loaded."

Example Project

Any project will do (if Wiki not disabled), nothing specific to a project configuration or contents.

What is the current bug behavior?

If internet bandwidth is not good enough, one can't open the draw.io (diagrams.net) editor in GitLab. After a few seconds, you get a "The diagrams.net editor could not be loaded." error message instead.

What is the expected correct behavior?

If internet bandwidth is not good enough, it should still be possible to open the draw.io (diagrams.net) editor in GitLab, even if it's a bit slow. Of course there might still be a limit to the loading time, to distinguish "slow" from "stuck", but the current 4 seconds timeout is too low for some users.

Relevant logs and/or screenshots

Firefox with DSL throttling and no diagrams.net resources yet in browser cache (see Steps to reproduce): gitlab-drawio-failure-with-DSL-throttling

For reference (and to show the size of the loaded resources), same with No Throttling (success): gitlab-drawio-success

Output of checks

This bug happens on GitLab.com

Possible fixes

Probably increasing the DRAWIO_IFRAME_TIMEOUT in drawio/constants.js. Current value is only 4000 (4 seconds).

Edited by 🤖 GitLab Bot 🤖