You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fix is pretty trivial with a regex in genCacheKey(). The issue is because the timestamp is tacked on afterwards, so isn't present in the url the first time around.
var genCacheKey = function (options) {
var url = options.url.replace(/jQuery.*/, '');
// Strip _={timestamp}, if cache is set to false
if (options.cache === false) {
url = url.replace(/\??_=\d{13}/, '');
}
return options.cacheKey || url + options.type + (options.data || '');
};
The text was updated successfully, but these errors were encountered:
Good catch, although I have to admit to some curiosity as to what circumstances might lead a developer to disable browser-level caching, but enable caching in local storage.
In any case, it looks like your proposed regex is a bit too specific - it assumes the _ parameter that jQuery appends will appear as the first parameter, which is not necessarily the case. Let's instead use the same regex that jQuery uses to detect the presence of the _ param:
/([?&])_=[^&]*/
If you'd like to make a pull request with the relevant change, I'll review and merge it.
Thanks for the regex tip. I managed to locate it in ajax.js for those wondering where you found it. The capture group isn't not really needed, but I guess we should be consistent with jQuery's version.
The fix is pretty trivial with a regex in genCacheKey(). The issue is because the timestamp is tacked on afterwards, so isn't present in the url the first time around.
The text was updated successfully, but these errors were encountered: