Skip to content

fix(web): avoid duplicate keys for same-second messages - #1415

Closed
RuffR1d3r wants to merge 1 commit into
meshtastic:mainfrom
RuffR1d3r:fix/message-key-collision
Closed

fix(web): avoid duplicate keys for same-second messages#1415
RuffR1d3r wants to merge 1 commit into
meshtastic:mainfrom
RuffR1d3r:fix/message-key-collision

Conversation

@RuffR1d3r

@RuffR1d3r RuffR1d3r commented Aug 26, 2026

Copy link
Copy Markdown

Fixes #1277

Fallback key from-date collides when two messages share sender and second-precision date. Append array index as discriminator so same-second bursts render as distinct DOM nodes. Stable messageId path untouched.

Testing:

  • vitest 247/247
  • tsc clean (only pre-existing App.tsx error)
  • oxlint clean

Research: React docs + CopilotKit #3258 (duplicate keys during streaming) — stable ID first, index only as fallback disambiguator, never Math.random()

Summary by CodeRabbit

  • Bug Fixes
    • Improved message display reliability when multiple messages share the same sender and date.
    • Prevented duplicate message rendering issues in channel chats.

Fallback key `from-date` collides when two messages share sender
and second-precision date. Append array index as discriminator so
same-second bursts render as distinct DOM nodes. Stable messageId
path untouched.

Fixes meshtastic#1277

Signed-off-by: RuffR1d3r <76077201+RuffR1d3r@users.noreply.github.com>
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

@RuffR1d3r is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b3c2bbf-b9a3-4b24-9043-c2aa92c7ea45

📥 Commits

Reviewing files that changed from the base of the PR and between cffd35f and 003fc5e.

📒 Files selected for processing (1)
  • apps/web/src/components/PageComponents/Messages/ChannelChat.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The message list fallback key now includes the mapped item index. Messages with messageId continue to use that identifier.

Changes

Message rendering key fix

Layer / File(s) Summary
Fallback key update
apps/web/src/components/PageComponents/Messages/ChannelChat.tsx
The message list callback receives the item index. The fallback Suspense key combines the sender, date, and index when messageId is unavailable.

Estimated code review effort: 2 (Simple) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 003fc

The PR only adjusts the fallback discriminator for message keys while preserving the stable messageId path. No actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: danditomaso

Poem

A rabbit checked each message line
And gave each fallback key a sign
Same sender, same second, no clash
The index now joins the dash
Messages hop in order fine

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: preventing duplicate React keys for messages sent within the same second.
Description check ✅ Passed The description identifies issue #1277, explains the fallback-key collision, summarizes the fix, and reports testing results. It omits the template headings and checklist, but the required content is …
Linked Issues check ✅ Passed The change satisfies issue #1277 by appending the array index to the fallback sender/date key while preserving the stable messageId path.
Out of Scope Changes check ✅ Passed The summarized change is limited to the message rendering key logic and directly supports issue #1277. No unrelated changes are identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Description check

Explanation

The description identifies issue #1277, explains the fallback-key collision, summarizes the fix, and reports testing results. It omits the template headings and checklist, but the required content is mostly complete.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@RuffR1d3r

Copy link
Copy Markdown
Author

/coderabbit review

@RuffR1d3r
RuffR1d3r marked this pull request as ready for review August 26, 2026 17:43
@RuffR1d3r RuffR1d3r closed this Aug 27, 2026
@RuffR1d3r

Copy link
Copy Markdown
Author

Duplicate of #1412 which already fixes #1277 key collision (uses messageId directly). Closing to avoid review noise.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Message list key falls back to ${from}-${date}, collides on same-second sends

1 participant