(force: boolean)
| 77 | } |
| 78 | |
| 79 | const scrollToBottom = (force: boolean) => { |
| 80 | if (!force && !active()) return |
| 81 | |
| 82 | if (force && store.userScrolled) setStore("userScrolled", false) |
| 83 | |
| 84 | const el = store.scrollRef |
| 85 | if (!el) return |
| 86 | |
| 87 | if (!force && store.userScrolled) return |
| 88 | |
| 89 | const distance = distanceFromBottom(el) |
| 90 | if (distance < 2) { |
| 91 | markAuto(el) |
| 92 | return |
| 93 | } |
| 94 | |
| 95 | // For auto-following content we prefer immediate updates to avoid |
| 96 | // visible "catch up" animations while content is still settling. |
| 97 | scrollToBottomNow("auto") |
| 98 | } |
| 99 | |
| 100 | const stop = () => { |
| 101 | const el = store.scrollRef |
no test coverage detected