The IMCE file browser is not visible when JS aggregation is enabled.

Created on 6 November 2023, over 1 year ago
Updated 12 September 2024, 7 months ago

Problem/Motivation

I am experiencing a similar issue where the IMCE file browser is not visible when JS aggregation is enabled.

Steps to reproduce

  1. Enable IMCE File Manager setting -> Common settings -> Use admin theme for IMCE paths.
  2. Enable Performance -> Aggregate JavaScript Files.
  3. Clear the cache.

Versions:
Drupal 10.1.6
IMCE: 3.0.9
Gin Admin Theme: 8.x-3.0-rc7

πŸ› Bug report
Status

Fixed

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada anjor.rao

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @anjor.rao
  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    Can you check if this problem also appears in Claro? Maybe you're using AvgAgg? AvgAgg has some abandoned CSS & JS processors which can break Claro & Gin (JSqueeze for example).

  • πŸ‡¨πŸ‡¦Canada anjor.rao

    I checked the issue in the Claro theme, and the File browser is visible. As for AvgAgg, I am not using this module.

  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    Then I'd look out for any JS errors on the site

  • πŸ‡¨πŸ‡¦Canada anjor.rao

    Hello, I've attached a screenshot. Could you please take a look? I tried checking if the Coffee module was causing any issues, but that doesn't seem to be the case. Additionally, I didn't see any JS errors on the Claro theme. Should I create an issue in the core project?

  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    Can you expand the error messages so we can see where in the code the error occurs? TY

  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich
  • πŸ‡ΊπŸ‡ΈUnited States jon.lund

    I can confirm that I am experiancing the same issue. When js aggrigation is turned on imce browser does not render. This only happens with Gin as the Admin Theme, it does not happen in either Claro or Olivero.

    Drupal 10.1.6 Gin 8.x-3.0-rc7 IMCE 3.0.9

  • πŸ‡¨πŸ‡¦Canada anjor.rao

    Hello,

    Please find the attached files. Let me know if you need more information.

  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    @anjor.rao thanks for sharing. I don't see the relation why Gin would break this so far as the error seems that Backbone.Model is not set and we don't use Backbone in Gin nor do we set any dependency on it.

  • πŸ‡¨πŸ‡¦Canada anjor.rao

    @saschaeggi, I checked similar JS files in the Claro theme; however, there are no errors. Please confirm if this falls under the Gin project's scope, or should I raise this issue in Drupal Core?

  • Status changed to Closed: cannot reproduce 11 months ago
  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich
  • πŸ‡¨πŸ‡΄Colombia tesla863 Chia

    Hey
    I had this problem and I was able to see a js error:

    And the IMCE window broke:

    I have generated a patch to use the optional chaining operator for the 'toolbarVariant' definition to avoid the error, and now the IMCE loads fine.
    I hope this can help someone else.

  • Status changed to Needs review 8 months ago
  • πŸ‡¨πŸ‡΄Colombia tesla863 Chia
  • Status changed to Postponed: needs info 8 months ago
  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    As the toolbar looks pretty much broken in the screenshots, maybe it would be better to move this to IMCE to look into this?

  • πŸ‡¨πŸ‡΄Colombia tesla863 Chia

    Maybe. I'm not sure what should define drupalSettings.gin.toolbar_variant, and it fails when the IMCE window is opened. It even fails when accessing directly via /admin/imce/browser. However, it could be a good idea to validate that it exists anyway to avoid breaking other scripts if it is not defined, this helped for my specific case: const toolbarVariant = drupalSettings?.gin?.toolbar_variant; in /js/toolbar.js

  • Merge request !483Add check for IMCE β†’ (Merged) created by saschaeggi
  • Status changed to Needs review 8 months ago
  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    I've opened a MR, this needs a review πŸ‘€

  • Status changed to Fixed 7 months ago
  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    Pushed a fix, thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024