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:
@@ -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());
|
||||
|
||||
|
Reference in New Issue
Block a user