This repository was archived by the owner on Mar 10, 2026. It is now read-only.
fix(sliding-sync): cache emoji packs, fix edit message rendering#134
Merged
fix(sliding-sync): cache emoji packs, fix edit message rendering#134
Conversation
c85257e to
a1f1b69
Compare
a1f1b69 to
1e1a7b2
Compare
added 2 commits
March 4, 2026 22:29
…r on Replace events, guard empty getContent()
1e1a7b2 to
6dcaea6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three sliding-sync related fixes:
1. Cache emoji / image packs in localStorage
imagePackCache.ts— new localStorage cache forImagePackinstances, keyed by user/scope. All five hooks inuseImagePacks.tsnow seed from cache on cold-start and write through on change. Reduces reliance on sliding sync delivering custom emoji state before first render.2. Prevent edit event leakage + align required_state
reactionOrEditEventnow also detects edits viam.new_contentpresence as a fallback for when the sliding sync proxy stripsm.relates_to— prevents stripped edit events from falling through and rendering as separate "Unsupported message" bubbles.required_stateinslidingSync.tsextended withm.room.power_levelsand cosmetics state events (m.room.cosmetics.*), which were previously missing from bundled subscriptions.3. Re-render on non-live Replace events + guard empty
getContent()Two fixes for edited messages showing as "Broken/Unsupported message" until an unrelated live event triggered a re-render:
useRelationUpdatehook — listens for non-liveRoomEvent.Timelineevents withrel_type=m.replace. Sliding sync delivers bundled/historical edits as non-live events that are silently ignored byuseLiveEventArrive; this hook triggers a shallowsetTimelineupdate immediately when they arrive.Empty
getContent()guard — when the sliding sync proxy delivers a Replace event withm.relates_tointact butm.new_contentabsent, the SDK'smakeReplaced()causesmEvent.getContent()to return{}. Passing{}toRenderMessageContentproduces "Broken message". Fix: detect the empty result and fall back tomEvent.getOriginalContent(), which bypassesmakeReplacedand returns the original unmodified content.msgTypeis now derived from the same resolved content object.