Let a caller own the realtime announcement of the message it is still building

Fixkamo-shared-library
Shipped
August 6, 2026 at 10:06 PM UTC
Author
Kamo
Commit
1a71a42

createMessage announced every new message on the session's realtime subject the moment the row was saved — inside the caller's transaction, before the caller had written anything else. For a chat message with an attachment that is too early to be true: the announcement went out with no attachments, and MediaController's own complete announcement followed ~60ms later, after the attachment rows committed. Subscribers keep the first event they see for a message id, so the incomplete one is the one that stuck; the image stayed missing from the message until the page was reloaded. The same race mislabels a social visitor's reply, which this method can only announce as messageType=MESSAGE while SocialMessageService announces it as SOCIAL_VISITOR. Callers that finish building the message themselves now pass publishRealtimeEvent=false and announce it once, when it is whole. Callers that don't publish their own event — the social feed, media streams — are unaffected.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing