collectiveaccess / providence

Cataloguing and data/media management application
GNU General Public License v3.0
299 stars 167 forks source link

jQuery Cache Busting Forces Half Megabyte Download on Every Mirador Load #1627

Open miqrogroove opened 2 weeks ago

miqrogroove commented 2 weeks ago

Unresolved problem described in #1551, which has been closed, still needs work.

jQuery cache busting used when loading the overlay resources. For example, on every click of a thumbnail for the Mirador viewer, the browser is required to perform an ajax request for a half megabyte file named mirador.js. This causes an unnecessary delay in rendering even on faster connections. The Universal viewer implementation doesn't seem to have the same bug.

miqrogroove commented 2 weeks ago

Workaround

Add this statement:

jQuery.ajaxSetup({ cache: true });

Before this statement:

https://github.com/collectiveaccess/providence/blob/e27068a0b02eadeb9f623e62678ef1689996568b/assets/ca/ca.genericpanel.js#L103-L107

I don't know if this would break anything in other areas of CA. jQuery documentation shows cache is normally true, but there is a built-in exception for script requests. If this setting is a proper boolean, it's unclear how setting it to the default value even changes anything.

miqrogroove commented 2 weeks ago

This was possibly fixed in Pawtucket already. I can reproduce this only in Providence.