Repository navigation
fix(app): cut a conversation title without leaving half a character - #740
Merged
davidmckayv merged 2 commits intoOct 6, 2026
Merged
Conversation
aniruddhaadak80
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
October 6, 2026 07:33
conversationLabel cut the title with slice(0, 60), and slice counts UTF-16 code units, so a title whose 60th unit was the first half of an emoji kept that half and dropped the second. The sidebar and the picker both draw this label, and both rendered a replacement character where the character should have been. lib/voice/cut.ts already exists for this and documents the case; lib/channels/route.ts inlines the same two-line guard for its own cut. This reuses openingOf rather than adding a third copy.
aniruddhaadak80
force-pushed
the
fix/channel-label-surrogate
branch
from
October 6, 2026 07:39
0a1f244 to
85d6c93
Compare
Contributor
Author
|
CI on this branch is waiting on a maintainer to approve the workflow run, so it reports The branch is rebased onto
|
# Conflicts: # CHANGELOG.md
This was referenced Oct 6, 2026
Closed
Closed
Merged
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.
What this changes
conversationLabelcut the conversation title withslice(0, 60).slicecounts UTF-16 code units and an emoji is two of them, so a title whose 60th unit was the first half of an emoji kept that half and dropped the second. The sidebar and the channel picker both draw this label, and both rendered a replacement character where the character should have been.app/src/lib/voice/cut.tsalready exists for this case and documents it, andapp/src/lib/channels/route.tsinlines the same two-line guard for its own cut. This reusesopeningOfrather than adding a third copy of it.The cut is at most one unit shorter than before, which is the behaviour
cut.tsalready specifies for every other caller.Where it runs
openingOfis a pure function of the string it is given, called during render.Boundary and audit
Changelog
CHANGELOG.mdunderUnreleased. A deployment behaves differently afterwards: a conversation whose title is cut lands on an emoji shows that emoji rather than a replacement character.Proof
app/src/lib/channels/label.tsand the newapp/tests/channel-label.test.ts, on Bun 1.3.14.The input is 59 ASCII characters and then an emoji, so the 60th code unit is the emoji's high surrogate and the cut lands between the halves.
Without the fix:
on
hasLoneSurrogate(label).With the fix:
bunx biome lintandbunx biome formatclean on both files;bun run typecheckinapp(tsc --noEmit) clean.