fix: add option to override date separator calculation - #3807
Closed
isekovanic wants to merge 3 commits into
Closed
isekovanic wants to merge 3 commits into
isekovanic wants to merge 3 commits into
Conversation
Contributor
SDK Size
|
isekovanic
marked this pull request as draft
September 15, 2026 20:05
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🎯 Goal
This PR fixes an issue where channels that get a system message at a day boundary render no date separators at all. Should resolve this Zendesk ticket.
The boundary gets consumed twice.
MessageWrappercomputes the correct separator for the system message and then drops it, because thetype === 'system'branch has no separator slot. The next regular message then compares against that system message, sees the same day, and renders nothing either. This has been the case since at leastv8.9.2.Fixing it also means picking a rule, and no single rule suits everyone, for example some integrations might want days containing only a session marker left undated, which can't be answered from a message's neighbours. So this PR fixes the default and adds a
getDateSeparatorsprop for rules the default can't express.🛠 Implementation details
A separator goes above the first row of each day, whatever type it is, so everything below a separator belongs to the day it names. There is no message-type special-casing left anywhere in the separator path.
The rule is neighbour-local, so each row derives its own separator from
previousMessageexactly as before so no list-wide pass.useDateSeparatorDatesreturnsundefinedunless an override is supplied, and there's a test pinning that.getDateSeparators(new, onChannel) receives every loaded message oldest-first and returns{ messageId: Date }:Only when it's set does the list resolve separators up front and hand each row its answer.
getDefaultDateSeparatorsis exported so integrators can build on the SDK's rule instead of restating it. Two details worth knowing when reviewing:undefinedfor a row means "no separator here" and is distinct from "no override" so the row readsgetDateSeparatorsfrom context to tell them apart. Collapsing the two would make an override that suppresses everything indistinguishable from no override at allDatethat's value-equal to the message's owncreated_atis collapsed back to that instance, so an override can't accidentally break row memoization by constructing newDates.Also here:
getDateSeparatorValuecompares an integer day key instead of formatting two strings (~13× cheaper, measured), and the sticky header no longer takes its date from a system message.Not breaking.
MessageWrapperandbuildMessageListWithNeighboursaren't exported.useMessageGroupStylesis public and still derivesnextMessageDateSeparatorDateitself when a caller omits it — contract-tested.🎨 UI Changes
Android
iOS
🧪 Testing
☑️ Checklist
developbranch