Skip to content

Cloud Library stuck on "Loading" when iframe loads before admin-page.js #1211

Description

@milicavs

Description

The Cloud Library page (Optimole > Cloud Library) can stay on the "Loading..." screen forever. It is intermittent and depends on how fast the browser and the admin page are.

render_dashboard_page() in inc/dam.php outputs the hidden #om-dam iframe and the .om-dam-loader overlay. Both things that unblock the page are wired up in assets/src/media/admin-page.js, which is enqueued in the footer:

  1. the iframe load listener that hides the outer loader and shows the iframe;
  2. the message listener that answers the DAM app's getUrl request with siteUrl.

On a heavy admin page (many plugins) or a slower machine, the iframe can finish loading and Dam.vue (optimole-service) can send getUrl before the footer script has run. Both events are missed:

  • the outer loader never hides, because the load event already fired;
  • Dam.vue waits forever on its own "Loading..." screen, because it sends getUrl once, with no retry or timeout.

Reproduction

Minimal harness in headless Chromium: the same markup as render_dashboard_page(), the real https://dashboard.optimole.com/dam iframe, and admin-page.js logic served from a footer script with an artificial delay.

Footer script iframe load getUrl sent listeners attached Result
no delay 1986 ms 2084 ms 6 ms loads
4 s delay 1303 ms 1356 ms 4004 ms stuck on Loading

Customer evidence matches both halves:

  • the WP Admin console shows a warning from dashboard.optimole.com:1 while the outer loader is still visible, so the iframe had loaded;
  • forcing #om-dam visible from the console reveals the DAM app's own "Loading..." screen, so the getUrl handshake was missed.

Seen with Optimole 4.2.17, WP 7.1.4, Chrome 116 (macOS 10.13) and intermittently on Chrome 156 (macOS 14), with Elementor, Yoast, WPForms and SearchWP active. Works in Firefox and from the standalone dashboard Library.

Suggested fix

  • Plugin: attach the listeners before the iframe can load (inline script right after the iframe, or register them from admin_head), and/or on init check whether the iframe has already loaded instead of relying only on the load event.
  • Service (Dam.vue): resend getUrl on an interval until setSource gets an answer, and show an error after a timeout instead of loading forever.

Workaround (verified in the harness)

Answer getUrl from admin_head on the optimole_page_optimole-dam screen: hide .om-dam-loader, show #om-dam, and post { siteUrl: get_site_url(), type: 'om-dam', context: 'browse' } back to event.source. A second reply from admin-page.js is harmless, because Dam.vue removes setSource after the first one.

Customer report: https://secure.helpscout.net/conversation/3496753537/

Activity

  1. added theissue type on Oct 29, 2026
  2. girishpanchal30 commented on Nov 16, 2026

    @girishpanchal30
    Contributor

    @milicavs i have fixed it with PR #1241

  3. milicavs commented on Nov 17, 2026

    @milicavs
    Author

    🧪 QA steps and test links

    Optimole → Cloud Library can stay on the Optimole logo with "Loading..." forever. It happens when the admin page is slow (many plugins, a slow computer): the library frame finishes loading before the page is ready to answer it, so the page never reveals it.

    Requires: a site connected to your Optimole account with Cloud Library on, and the Code Snippets plugin (step 1 makes the slow page happen every time).

    Link Build Bot check
    Reproduce the bug Optimole 4.2.20 (released) ✅ Reproduced: logo and "Loading..." still showing after 9 s; the frame had loaded but never got the site's answer
    Verify the fix PR #1241 build b516245 ✅ Fixed: with the same 4 s delay, the loader is gone and the frame shows "connected to" the site

    In the links:

    • Steps 1 and 2 are already done, and the links open on Optimole → Cloud Library.
    • Optimole runs on a fake connection, so the frame shows a small stand-in page instead of the real Cloud Library. Like the real app, it asks the site for its address once and says "connected to " when the site answers.
    • The 4-second delay from step 1 is a must-use plugin there, not a Code Snippet.
    • Tools → QA Logs shows debug.log.

    Reproduce on Optimole 4.2.20:

    1. Snippets → Add New, title QA 1211: slow Cloud Library page, code below, then Save and Activate.
      add_action( 'wp_ajax_qa_slow_script', function () {
      	sleep( 4 );
      	header( 'Content-Type: application/javascript' );
      	exit;
      } );
      add_action( 'admin_footer', function () {
      	if ( 'optimole_page_optimole-dam' === get_current_screen()->id ) {
      		echo '<script src="' . esc_url( admin_url( 'admin-ajax.php?action=qa_slow_script' ) ) . '"></script>';
      	}
      } );
    2. Go to Optimole → Cloud Library.
    3. Wait 10 seconds.
    • Bug: the Optimole logo and "Loading..." never go away.
    • Fixed: the Cloud Library grid appears after a few seconds.
    Edge cases
    • Snippet off, Cloud Library reloaded 5 times: the grid appears every time.
    • Snippet off, Chrome DevTools CPU throttling at 6x, 5 reloads: the grid appears every time.
    • Block editor, Image block → Media Library, Optimole tab: images still list and insert.
    • A busy admin (Elementor, Yoast, WPForms, SearchWP active), snippet off: Cloud Library loads.

    Fix: #1241 (open)

  4. pirate-bot commented on Nov 17, 2026

    @pirate-bot
    Collaborator

    QA agent — 🟡 Needs human QA · The simulated Cloud Library loading race is fixed; the real library still needs testing.

    With a simulated slow admin page, the loader cleared and the library frame received the site address. The same scenario stayed stuck on the base build. A simulated cloud image also inserted and remained after saving, but the real library and real image insertion still need checking with a connected account.

    Worth a human look

    1. Try repeated Cloud Library reloads with a real connected account, 6x CPU throttling and the customer's SearchWP-inclusive plugin setup.
    2. Insert a real Cloud Library image through the Optimole tab in an Image block and an Elementor Image Box with image replacement enabled.
    3. Check the first Cloud Library load immediately after enabling the busy plugins; one simulated attempt did not show the frame, although subsequent attempts did.
    4. Check the issue's suggested service-side retry and timeout when no site-address response arrives; that service change is outside this plugin PR.
    Checks (2 passed · 2 not tested)
    • ✅ When the Cloud Library iframe loads before a delayed footer script, the outer Loading overlay disappears and the iframe is shown.
    • ✅ When the Cloud Library iframe asks for the site URL before a delayed footer script, it receives the site's URL and can leave its own loading state.
    • ⏸️ On a busy admin with Chrome CPU throttled 6x, the real Cloud Library grid appears on every repeated reload.
    • ⏸️ An image can be selected from the Optimole tab in the Media Library modal and inserted into the editor.

    Full report, evidence and session trail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions