Skip to content

Commit 11762f4

Browse files
committed
fix ajax with FPC
1 parent 64e9df5 commit 11762f4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

view/frontend/web/js/action/submit-filter.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,16 @@ define(
4747
/** start loader */
4848
loader.startLoader();
4949

50-
/** change browser url */
50+
/** fix load page FPC */
51+
let urlTmp = new URL(submitUrl);
52+
if(url.searchParams.get('mpLayer')){
53+
url.searchParams.delete('mpLayer');
54+
}
55+
/** change browser url */
5156
if (typeof window.history.pushState === 'function' && (typeof isChangeUrl === 'undefined')) {
52-
window.history.pushState({url: submitUrl}, '', submitUrl);
57+
window.history.pushState({url: submitUrl}, '', urlTmp);
5358
}
59+
5460
if (method === 'post') {// For 'add to wishlist' & 'add to compare' event
5561
return storage.post(submitUrl).done(
5662
).fail(
@@ -62,7 +68,7 @@ define(
6268
});
6369
}
6470

65-
return storage.get(submitUrl).done(
71+
return $.get({url:submitUrl, cache:true}, {'mpLayer': 1}).done(
6672
function (response) {
6773
if (response.backUrl) {
6874
window.location = response.backUrl;

0 commit comments

Comments
 (0)