Skip to content

Keep the channel state of a deleted channel and record its deletion date - #6715

Draft
gpunto wants to merge 1 commit into
developfrom
port/develop/channel-deleted-state
Draft

gpunto wants to merge 1 commit into
developfrom
port/develop/channel-deleted-state

Conversation

@gpunto

@gpunto gpunto commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Goal

ChannelState.channelData.deletedAt is never populated, so a screen has no way to tell that its channel
was deleted. On the current channel state implementation the deletion also blanks the open screen: the
message list empties and the channel data resets to a placeholder with no name.

Port of #6693 to develop.

Part of AND-1522

Implementation

  • Forward a batch to the channel logic before discarding the channel. EventHandlerSequential evicted the
    channel from both registries first, so channel.deleted never reached the channel event handler and the
    branch setting the deletion date was unreachable. Both registries are now evicted right after the batch is
    handled.
  • Stop destroying the state of a deleted channel in StateRegistry. It is still dropped from the registry,
    so later lookups build a fresh state, but consumers holding it keep the channel as it was.
    StateRegistry.clear() still destroys everything on logout.
  • Handle notification.channel_deleted in both channel event handlers, which had no branch for it.
  • Record the deletion date even when the channel data has not loaded yet. ChannelStateImpl.deleteChannel
    copied onto a null value and dropped the deletion, unlike the legacy implementation.
  • Stop clearing the messages on deletion. Truncation remains the one event that empties a channel, matching
    iOS, where message visibility is gated on the channel's truncatedAt and never on its deletion date.

Testing

  • New EventHandlerSequentialChannelDeletedTest covers both deletion events against both channel state
    implementations, over the real StateRegistry and LogicRegistry, asserting the deletion date reaches an
    active channel's state, its messages survive, and the channel is discarded from the registry.
  • Verified on a device: with a channel open, deleting it kept the name and all messages and moved deletedAt
    from null to the deletion date. Without the change, the same run empties the message list and blanks the
    name, with no deletion date.

@gpunto gpunto added the pr:bug Bug fix label Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.07 MB 6.08 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.39 MB 11.39 MB 0.00 MB 🟢
stream-chat-android-compose 13.06 MB 13.06 MB 0.00 MB 🟢

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant