Repository navigation
fix(gpui): load older thread replies after the list releases its state - #91
thebrandonlucas merged 3 commits into
Conversation
GPUI calls a list's scroll handler while it holds the list's state borrowed. The thread panel's handler called load_older, which reads and changes that state, so scrolling up in a thread with older replies panicked with "RefCell already borrowed" and aborted the app. Run load_older with cx.defer instead. Fixes #89
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Deferred older-reply loading apps/buzz-gpui/crates/app/src/ui/thread.rs |
The near-top scroll handler clones its weak panel reference and defers load_older() until GPUI releases the list state. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
- voltagecloud/buzz#89 describes the same
RefCellborrow panic when loading older replies from the thread scroll handler. This change defers that call.
Suggested labels: human review wanted
Suggested reviewers: tee8z
Merge Risk: 
Minimal · previous review 4c9bc
-
The reported scroll crash is addressed without changing older-reply loading behavior.
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
Issue
#89requires deferring thread-panelload_olderuntil GPUI releases the list-state borrow. Inapps/buzz-gpui/crates/app/src/ui/thread.rs, the scroll handler clones the weak entity and callsload_olderinsidecx.defer. The reported validation also states that the targeted clippy command passes.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
tee8z
left a comment
There was a problem hiding this comment.
Approving.
- The cause checks out.
load_oldercallscapture_older_anchor, which callspause_following_tailandlogical_scroll_topon the sameListStatethat GPUI holds borrowed while it runs the scroll handler.cx.deferis the minimal fix. - I checked the other
set_scroll_handlerusers. Channel'sload_near_toponly reads the timeline model and callsmodel.load_older(). The emoji picker only sets its own fields. Neither touches its list, so leaving them unchanged is right. - The keyboard path (
thread.rs,logical_scroll_top() < LOAD_OLDER_WITHIN→load_older()) runs outside the handler, so the fix doesn't affect it. - A burst of scroll events can queue several deferred
load_oldercalls. That's harmless:ThreadState::startreturns early whileself.run.is_some(), so only one page fetch runs.
Not verified here: a crash repro with the fix. The PR's step (open a thread with more than one page of replies, scroll to the top) is the human check.
Minimalism 10 · elegance 9 · correctness 9.
tee8z
left a comment
There was a problem hiding this comment.
Re-approving. The earlier approval was dismissed by the stale-review automation when the stack's merge commits propagated #90's fix (17:39:52Z); this PR's own diff is unchanged from what I reviewed. Findings and gates from the previous review stand.
Problem
Scrolling up in a thread that has older replies aborts the app (#89):
GPUI calls a list's scroll handler from
ListState::scroll, while it holds the list'sRefCellborrowed mutably. The thread panel's handler calledload_older, which callspause_following_tailandlogical_scroll_topon the same list.Change
The handler runs
load_olderwithcx.defer, after GPUI releases the borrow. The other scroll handlers (channel, emoji picker, avatar editor) do not touch their list's state, so they are unchanged.Validation
cargo clippy -p buzz-gpui --features voltage-sandbox --all-targets -D warnings: passes.Fixes #89 · Linear DEV-2981
Summary by CodeRabbit