Skip to content

Fix thread hang edge case#778

Open
7w1 wants to merge 2 commits intodevfrom
fix/thread-edge-case
Open

Fix thread hang edge case#778
7w1 wants to merge 2 commits intodevfrom
fix/thread-edge-case

Conversation

@7w1
Copy link
Copy Markdown
Member

@7w1 7w1 commented May 8, 2026

Description

Fixes the bug that occurs when a reply to a message that also has replies (so a message in the middle of a reply chain) has a thread started on that message causing a hang.

My shortcut introduced to improve loading speeds by bypassing the SDKs on-load thread single event spam created empty fake thread events whenever it was called. It assigned each of those as a thread root message, bypassing the SDKs various checks. As a result, when a thread was started involving those bypassed shells, uh, they didn't always get properly reloaded and had extraneous data causing infinite loops and whatnot.

Now, long story short, there's an extra method that actually checks for the thread root along with associated fixes to reduce rerenders and calculations and... well I tried a lot of random stuff, some works, some didn't, and to be totally honest I'm not 100% sure how all these changes work.

But hey it works! I think thread performance is still a little worse than the main timeline, not specifically related to this, but that's all noted and out of scope for this PR.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).

AI was involved in the debugging stages to locate the issue and handled the test case updates.

@7w1 7w1 requested a review from hazre as a code owner May 8, 2026 21:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

Status Preview URL Commit Alias Updated (UTC)
✅ Deployment successful! https://pr-778-sable.raspy-dream-bb1d.workers.dev a37b32b pr-778 Fri, 08 May 2026 21:47:26 GMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant