Skip to content
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
7w1 merged 2 commits into7w1:devfrom
CloudHub-Social:fix/sliding-sync
Mar 5, 2026
Merged

fix(sliding-sync): cache emoji packs, fix edit message rendering#134
7w1 merged 2 commits into7w1:devfrom
CloudHub-Social:fix/sliding-sync

Conversation

@Just-Insane
Copy link
Collaborator

Summary

Three sliding-sync related fixes:

1. Cache emoji / image packs in localStorage

imagePackCache.ts — new localStorage cache for ImagePack instances, keyed by user/scope. All five hooks in useImagePacks.ts now 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

  • reactionOrEditEvent now also detects edits via m.new_content presence as a fallback for when the sliding sync proxy strips m.relates_to — prevents stripped edit events from falling through and rendering as separate "Unsupported message" bubbles.
  • required_state in slidingSync.ts extended with m.room.power_levels and 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:

useRelationUpdate hook — listens for non-live RoomEvent.Timeline events with rel_type=m.replace. Sliding sync delivers bundled/historical edits as non-live events that are silently ignored by useLiveEventArrive; this hook triggers a shallow setTimeline update immediately when they arrive.

Empty getContent() guard — when the sliding sync proxy delivers a Replace event with m.relates_to intact but m.new_content absent, the SDK's makeReplaced() causes mEvent.getContent() to return {}. Passing {} to RenderMessageContent produces "Broken message". Fix: detect the empty result and fall back to mEvent.getOriginalContent(), which bypasses makeReplaced and returns the original unmodified content. msgType is now derived from the same resolved content object.

@Just-Insane Just-Insane marked this pull request as draft March 5, 2026 03:20
@Just-Insane Just-Insane marked this pull request as ready for review March 5, 2026 03:26
@7w1 7w1 merged commit bea1aa1 into 7w1:dev Mar 5, 2026
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants