mirror of
https://github.com/block/buzz.git
synced 2026-11-27 11:41:21 +00:00
The mid-history prepend re-anchor (`scrollBy(0, drift)` in the post-commit layout effect) is main's one mid-fling scroll writer: when an older-history prepend commits while the user is flinging, it fires against live momentum and produces the walk-blind position jump. There is no event-driven "fling ended" signal to gate it on — WebKit coalesces momentum `scroll` events off the scrolling thread, so the 100ms debounce starves exactly when the fling is fastest (the mechanism pinned in Lane C). Add an opt-in, default-off polled quiet-window gate. `observeScrollSettle` polls `container.scrollTop` on requestAnimationFrame and declares settle only after k *consecutive* zero-delta frames; the re-anchor is deferred behind it and re-measures drift at settle time so it compensates the row's resting position, not a stale mid-fling read. A newer prepend, channel switch, or unmount cancels any pending correction so only the freshest anchor is re-pinned. Design edge #1 (walk-blind #1662 mechanism): WebKit freezes scrollTop reads for ~2 coalesced frames mid-fling. k MUST exceed that window or the gate reads the freeze as "settled" and fires mid-momentum, recreating the bug. Default k=3 clears the ~2-frame freeze with one frame of margin; `observeScrollSettle` clamps any caller value up to that floor so a mis-tuned k can never regress below it. Tune against the classifier, not by eye. A3 trade (for the PR body): this does not eliminate the correction, it defers it. The artifact the user feels moves from a jump mid-scroll to a small settle-time adjustment as the reading row snaps back once at rest. Default-off ⇒ byte-identical to main: no consumer wires `settleGate`, so the re-anchor runs immediately on the prepend commit as it always has. Verified: smoke behavior-contract tier (scroll-history + timeline-no-shift + virtualization, 25 tests) green; new observeScrollSettle unit tests (7) green, including the coalesced-freeze survival case; tsc + biome clean. Co-authored-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com> Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
Buzz
Desktop chat shell with:
- Tauri + React + TypeScript + Vite
- Tailwind CSS
- shadcn/ui-ready shared components
- Biome (lint/format/check)
- Feature-driven frontend structure
Scripts
pnpm dev- run the web frontendpnpm tauri dev- run the desktop apppnpm build- typecheck and build frontendpnpm typecheck- TypeScript checkspnpm lint- Biome lintpnpm format- Biome format (write)pnpm check- Biome check
Structure
src/shared- reusable app-wide code (ui,lib,styles)src/features- feature modules (vertical slices)src/app- top-level app composition