webstaff reporter: auto-resize no longer happens

Bug #1753008 reported by Galen Charlton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned

Bug Description

When opening the reports page in the web staff client for 3.1-beta/master, the iframe fails to automatically resize to fit the length of the embedded page and the following error is logged in the Javascript console:

eframe.js:104 Uncaught ReferenceError: iFrameResize is not defined
    at h.$scope.egEmbedFrameLoader (eframe.js:104)
    at HTMLIFrameElement.<anonymous> (eframe.js:46)
    at HTMLIFrameElement.dispatch (jquery.min.js:2)
    at HTMLIFrameElement.y.handle (jquery.min.js:2)

Initial testing and comparison with rel_3_0 strongly suggests that issue was introduced by the change to Webpack and the bundling of iframe-resizer into the vendor bundle.

Evergreen master/3.1

Galen Charlton (gmc)
Changed in evergreen:
milestone: none → 3.1-rc
importance: Undecided → Medium
Revision history for this message
Dan Wells (dbw2) wrote :

I noticed this as well, and can confirm it is Webpack related. To repeat what was said on IRC, Webpack messes with the iframeResizer.js file, and this causes the iFrameResize function to not be created on 'window'. Maybe this is part of what Webpack is supposed to do, but we somehow aren't using the whole stack quite right, or this package isn't quite compatible with Webpack when used this way.

More specifically, I see these lines near the end of that js:

if (typeof define === 'function' && define.amd) {
    define([],factory);

become:

if (true) {
   !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),...

Ultimately, due to 'if (true)', we do not get the later 'else' branch which creates the global (window) function.

I am not sure what the overall requirements are to successfully bundle packages, but the shortest path to working probably involves not packing this module (as we do for a couple others).

Revision history for this message
Bill Erickson (berick) wrote :

Agreed loading the script directly and bypassing webpack is the best approach for now. I'll post a patch.

Changed in evergreen:
assignee: nobody → Bill Erickson (berick)
status: New → Confirmed
Revision history for this message
Bill Erickson (berick) wrote :

Fix pushed:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1753008-iframe-resizer-via-script

With this, iframeResizer.min.js is now loaded via script tag. During the build, we are also copying iframeResizer.contentWindow.min.js to build/js/ in case other code needs to load it.

Confirmed the reporter UI fills the page now.

tags: added: pullrequest webstaffclient
Changed in evergreen:
assignee: Bill Erickson (berick) → nobody
Revision history for this message
Galen Charlton (gmc) wrote :

Patch works for me. Sign-off branch here: user/gmcharlt/lp1753008_signoff

Changed in evergreen:
assignee: nobody → Galen Charlton (gmc)
tags: added: signedoff
Revision history for this message
Bill Erickson (berick) wrote :

This bug is also preventing the template editor from loading. Merging now..

Revision history for this message
Bill Erickson (berick) wrote :

Merged to master. Thanks for the sign-off, Galen.

Changed in evergreen:
assignee: Galen Charlton (gmc) → nobody
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.