Hi, I noticed one issue which I alredy patched. Here is explanation (AI generated):
Sticky title click sometimes stops mid-thread instead of scrolling to the top
First off — thanks for this extension, it's genuinely handy. I ran into a small but consistently reproducible issue with the click-to-scroll-to-top behaviour of the sticky title panel.
Symptom
Clicking the .StickyTitlePanel-container is meant to jump to the very top of the discussion — the same as the post stream scrubber's "scroll to first" button (.Scrubber-first). Most of the time it works, but every so often it stops somewhere in the middle of the thread instead of at the top. The scrubber's own "first" button always lands at the top.
Root cause
The panel's click handler uses stream.goToNumber(1):
// js/src/forum/index.js
const scrollToFirst = () => this.stream && this.stream.goToNumber(1);
goToNumber() runs loadNearNumber() and scrolls to the post with that number. That's fuzzy: if post number 1 can't be located precisely — e.g. the first post was deleted, there are gaps in the post numbering, or there's a timing race with the lazy-loaded stream — it settles on the nearest post, which can be mid-thread.
Flarum core's scrubber instead uses goToFirst(), which is goToIndex(0) — the absolute first item by index, and therefore deterministic:
// flarum/core — PostStreamState
goToFirst() {
return this.goToIndex(0);
}
Suggested fix
Switching the handler to goToFirst() makes the panel behave exactly like the scrubber and resolves the issue:
- const scrollToFirst = () => this.stream && this.stream.goToNumber(1);
+ const scrollToFirst = () => this.stream && this.stream.goToFirst();
Tested on Flarum 1.8.16 with sticky-title v1.8.1 — after the change, the click reliably jumps to the top every single time, identical to the scrubber.
Thanks again for the extension! 🙂
Analysis & write-up by Claude (Anthropic's AI assistant, via Claude Code), while debugging this on a live forum for the site admin.