mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-16 11:37:37 +01:00
fix: regression with updateHistory
going from /recent to index was not updating the url if empty string is passed to replaceState
This commit is contained in:
@@ -198,9 +198,10 @@ ajaxify.widgets = { render: render };
|
|||||||
ajaxify.currentPage = url.split(/[?#]/)[0];
|
ajaxify.currentPage = url.split(/[?#]/)[0];
|
||||||
ajaxify.requestedPage = null;
|
ajaxify.requestedPage = null;
|
||||||
if (window.history && window.history.pushState) {
|
if (window.history && window.history.pushState) {
|
||||||
|
const { relative_path } = config;
|
||||||
window.history[!quiet ? 'pushState' : 'replaceState']({
|
window.history[!quiet ? 'pushState' : 'replaceState']({
|
||||||
url: url,
|
url: url,
|
||||||
}, '', config.relative_path + (url ? '/' + url : ''));
|
}, '', relative_path + (url ? '/' + url : (relative_path ? '' : '/')));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -559,9 +560,10 @@ $(document).ready(function () {
|
|||||||
if (ev !== null && ev.state) {
|
if (ev !== null && ev.state) {
|
||||||
const { returnPath } = ev.state;
|
const { returnPath } = ev.state;
|
||||||
if (ev.state.url === null && returnPath !== undefined) {
|
if (ev.state.url === null && returnPath !== undefined) {
|
||||||
|
const { relative_path } = config;
|
||||||
window.history.replaceState({
|
window.history.replaceState({
|
||||||
url: returnPath,
|
url: returnPath,
|
||||||
}, '', config.relative_path + (returnPath ? '/' + returnPath : ''));
|
}, '', relative_path + (returnPath ? '/' + returnPath : (relative_path ? '' : '/')));
|
||||||
} else if (ev.state.url !== undefined) {
|
} else if (ev.state.url !== undefined) {
|
||||||
ajaxify.handleTransientElements();
|
ajaxify.handleTransientElements();
|
||||||
ajaxify.go(ev.state.url, function () {
|
ajaxify.go(ev.state.url, function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user