1
0
mirror of https://github.com/flarum/core.git synced 2025-08-15 04:44:08 +02:00

forum: fix setting history state multiple times when scrolling in DiscussionPage

This commit is contained in:
David Sevilla Martin
2020-03-19 11:33:14 -04:00
parent c819a8d520
commit cfc0000df0
3 changed files with 12 additions and 9 deletions

View File

@@ -272,12 +272,13 @@ export default class DiscussionPage extends Page {
positionChanged(startNumber: number, endNumber: number) {
const discussion = this.discussion;
if (!discussion) return;
// Construct a URL to this discussion with the updated position, then
// replace it into the window's history and our own history stack.
const url = app.route.discussion(discussion, (this.near = startNumber));
m.route.set(url, true);
window.history.replaceState(null, document.title, url);
m.route.set(url, true, { replace: true });
app.history.push('discussion', discussion.title());