Sometimes when using the browser back button, the product grid in the category doesn't get updated.
After debugging we noticed on initial load of a category, there is no ajax call being done yet, therefore the event.state is not yet updated through the 'this._updateState(response);' function in navigation-form.js:198.
So when going back using the browser button event.state is empty in '_bindPopChangeHandler: function(){' causing the content not to be updated.
A possible workaround/fix we found is adding this to the _hookEvents function within the if (this.options.ajaxFilters) { in navigation-form.js:30
if (this.options.ajaxFilters) {
if (!$('.filter-actions').length) {
$.ajax({
url: this.options.ajaxEndpoint,
data: this._getFilterParameters(),
cache: true,
success: function (response) {
this._updateState(response);
}.bind(this),
error: function (jqXHR, errorStatus) {
if (errorStatus !== 'abort') {
// Something went wrong, try to navigate to the selected filter
this._defaultHandler(event);
}
}.bind(this)
});
}
this._bindPopChangeHandler();
}
The if (!$('.filter-actions').length) { statement is just a test, it's probably better to set a flag to determine if event.state has been set at least once. So the idea is that this._updateState(response); should be triggered at least once to make sure there is always a state to go back to. Hopefully it will give at least some idea on how/where to fix it.
Issue Brief
Sometimes when using the browser back button, the product grid in the category doesn't get updated.
After debugging we noticed on initial load of a category, there is no ajax call being done yet, therefore the event.state is not yet updated through the 'this._updateState(response);' function in navigation-form.js:198. So when going back using the browser button event.state is empty in '_bindPopChangeHandler: function(){' causing the content not to be updated.
A possible workaround/fix we found is adding this to the _hookEvents function within the
if (this.options.ajaxFilters) {
in navigation-form.js:30The
if (!$('.filter-actions').length) {
statement is just a test, it's probably better to set a flag to determine if event.state has been set at least once. So the idea is thatthis._updateState(response);
should be triggered at least once to make sure there is always a state to go back to. Hopefully it will give at least some idea on how/where to fix it.Environment
Steps to reproduce
Actual result
Expected result