Uploaded image for project: 'Magnolia Groovy Module'
  1. Magnolia Groovy Module
  2. MGNLGROOVY-177

Multiple, conflicting jQuery versions pulled in by Groovy module

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Neutral
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.6, 2.6.4, 2.7.1
    • Component/s: None
    • Labels:
      None
    • Release notes required:
      Yes
    • Sprint:
      Basel 150
    • Story Points:
      2
    • Magnolia Release:
      5.5.12, 5.6.8, 5.7.1

      Description

      This results in console errors as well as the app switcher blocking the UI. The problem is that Groovy module's Terminal component causes jQuery to be loaded twice (it is already loaded by MagnoliaShell). Even if it is the same version, this'll lead to conflicts, as we don't use the no conflict mode: https://api.jquery.com/jquery.noconflict/

      To reproduce the issue consistently

      • Open Groovy console (the terminal subapp, not the tree view one)
      • Open Config app
      • Hit Alt+Shift in order to bring up AppSwitcher
        • UI gets stuck
        • in the browser's log one can see
          Error: Cannot read property 'specialKeys' of undefined
              at areKeysEqual (appswitcher_shortcut_monitor_connector.js:50)

      As a workaround, to unfreeze UI, append ?restartApplication to the URL

      The issue is discussed quite at length here https://vaadin.com/forum/thread/3390058 but the cause of our woes boils down to this

      @JavaScript only loads every uniquely named script file once. This means that if you have two different components both using @JavaScript("jqyery.js") and include multiple instances of each component in a view, then jquery.js would still only be loaded once. This is kind of a hack because the framework assumes that both jquery.js files are identical even though they might be separate files from different parts of the file tree - it just uses the one that it happens to stumble upon first. If you on the other hand have one component with @JavaScript("jquery-1.7.js") and another with @JavaScript("jqery-1.8.js"), then both files would indeed be loaded (although each file is still only loaded once). You can also use an absolute URL, e.g. @JavaScript("http://code.jquery.com/jquery-1.7.js"). In this case the full absolute URL is used when looking for duplicates, meaning that @JavaScript("jquery-1.7.js") would be seen as a separate file that would also be loaded.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fgrilli Federico Grilli
                Reporter:
                mmichel Maxime Michel
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: