Skip to content

fix(threads): skip classic-sync backfill when server-side thread support is active#438

Merged
7w1 merged 1 commit intodevfrom
fix/thread-drawer-server-side-backfill
Mar 20, 2026
Merged

fix(threads): skip classic-sync backfill when server-side thread support is active#438
7w1 merged 1 commit intodevfrom
fix/thread-drawer-server-side-backfill

Conversation

@Just-Insane
Copy link
Contributor

Description

Fixes a flood of EventTimelineSet.addEventToTimeline: Ignoring event=… that does not belong in timeline=… timelineSet(threadId=…) console warnings that appeared whenever a thread was opened in rooms with server-side thread support enabled (the default on Synapse/element.io homeservers).

Root cause: PR #343 added a backfill useEffect in ThreadDrawer that calls thread.addEvents(liveEvents, false) when the Thread object had no replies (classic-sync workaround). However, when server-side thread support is active thread.initialEventsFetched starts as false — meaning the SDK is already going to call updateThreadMetadata()timelineSet.resetLiveTimeline() + client.paginateEventTimeline() automatically. Calling thread.addEvents() ourselves before that completes causes events to be inserted into a timeline that is mid-reset, so canContain() fails for every event → warning flood.

Fix: Guard the backfill with if (!thread.initialEventsFetched) return. This is false exactly when Thread.hasServerSideSupport is set, so the backfill now only runs in the pure classic-sync case it was designed for.

Fixes #

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

AI assistance level

  • None — No AI tools were used
  • Research only — AI used for research, brainstorming, or understanding existing code; no generated code included
  • AI-assisted — AI suggested code or logic that I reviewed, tested, and understand fully; I can explain every change
  • Primarily AI-generated — The majority of code was AI-generated; I have thoroughly reviewed it, verified correctness, and made it my own

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

@github-actions
Copy link
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

Status Preview URL Commit Alias Updated (UTC)
✅ Deployment successful! https://pr-438-sable.raspy-dream-bb1d.workers.dev b71fd4f pr-438 Fri, 20 Mar 2026 20:23:02 GMT

@Just-Insane Just-Insane marked this pull request as ready for review March 20, 2026 20:43
@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners March 20, 2026 20:43
@7w1 7w1 added this pull request to the merge queue Mar 20, 2026
Merged via the queue into dev with commit 70b38bd Mar 20, 2026
9 checks passed
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.

2 participants