I was building a devtool utility for sticky events, and I noticed that the _unstable_getStickyEvents returns several events per unique msc4354_sticky_key
This is unexpected, there should be only one active sticky event per sticky key.
The problem is that the sticky key is in the event content and is encrypted.
But the unstableStickyExpiresAt is at the event root.
What happens
- The SDK consider an encrypted event as sticky (because there is a
unstableStickyExpiresAt in the event)
- Then it tries to get the
msc4354_sticky_key in the content. But it fails because the event is not yet decrypted (decryptionPromise is pending)
- So the event is added in the list of
unkeyed events unkeyedStickyEvents, that is events that have no sticky key.
later on the event is decrypted (and mutated in place), but it wrongly stays in the unkeyedStickyEvents list!
What should happen
The RoomStickyEventsStore should wait for event to be decrypted before processing it
I was building a devtool utility for sticky events, and I noticed that the
_unstable_getStickyEventsreturns several events per uniquemsc4354_sticky_keyThis is unexpected, there should be only one active sticky event per sticky key.
The problem is that the sticky key is in the event content and is encrypted.
But the
unstableStickyExpiresAtis at the event root.What happens
unstableStickyExpiresAtin the event)msc4354_sticky_keyin the content. But it fails because the event is not yet decrypted (decryptionPromise is pending)unkeyedevents unkeyedStickyEvents, that is events that have no sticky key.later on the event is decrypted (and mutated in place), but it wrongly stays in the
unkeyedStickyEventslist!What should happen
The
RoomStickyEventsStoreshould wait for event to be decrypted before processing it