[MGNLGROOVY-177] Multiple, conflicting jQuery versions pulled in by Groovy module Created: 29/Jun/18  Updated: 06/Jul/18  Resolved: 05/Jul/18

Status: Closed
Project: Magnolia Groovy Module
Component/s: None
Affects Version/s: None
Fix Version/s: 2.5.6, 2.6.4, 2.7.1

Type: Bug Priority: Neutral
Reporter: Maxime Michel Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File 2018-06-29_11-48-12.png     PNG File app-switcher-stuck.png     PNG File appswitcher-console-log.png    
Issue Links:
Git Code Review
git code review opened MGNLGROOVY-178 Create UI test for Rescue App Open
Relates
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Release notes required:
Yes
Sprint: Basel 150
Story Points: 2

 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.


Generated at Mon Feb 12 05:56:21 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.