Help Center: show one CSAT prompt per conversation - #113357
Merged
Merged
Conversation
Zendesk can emit more than one message tagged `csat` when a chat closes. Every one of them is rendered with the same overridden copy and its own thumbs, so the chat shows what looks like a duplicate survey and the user can submit conflicting ratings for a single ticket. Keep only the most recent CSAT prompt in both renderers, and let `getMessageUniqueIdentifier` fall back to the Zendesk message id so that deduplication and React keys work for Zendesk-sent messages, which carry none of the other identifiers. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
WordPress.com
Automattic for Agencies
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
escapemanuele
marked this pull request as ready for review
August 6, 2026 17:27
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
packages/odie-client/src/components/message/messages-cluster/messages-cluster.tsx:123
Array.prototype.at()isn’t used elsewhere inpackages/odie-clientproduction code and can be a runtime compatibility footgun if this bundle is ever executed in browsers withoutatsupport (it’s not transpiled by Babel). Prefer a more widely-supported way to get the last element to avoid a hard crash.
const sortedMessages = sortMessagesByTimestamp( messages );
const lastCSATMessage = sortedMessages.filter( isCSATMessage ).at( -1 );
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.
Fixes https://linear.app/a8c/issue/SUTO-1454/duplicate-csat-message-appears-when-chat-closes
Proposed Changes
Only the most recent CSAT prompt is rendered when a chat closes, instead of one prompt per message Zendesk tags as
csat.getMessageUniqueIdentifiernow falls back to the Zendesk message id. Zendesk-sent messages carry none of the identifiers it looked for (temporary_id,message_id,internal_message_id,local_timestamp), so it returnedundefinedfor all of them — which silently disabled message deduplication and left React keys empty for every Zendesk message.Why are these changes being made?
When a support chat closes, the Help Center shows the rating prompt twice — the same “How would you rate your support experience?” copy with two sets of thumbs, one under the other. It reproduces on production today and was hit by several people during a support-flow test.
It is not just cosmetic. Both prompts are live, so a user can answer both, and answer them differently. That happened during testing: one good, one bad, both submitted against the same ticket, with Zendesk keeping whichever landed last. So a rating can end up recorded as the opposite of what the person meant.
The two prompts look identical because the chat overrides the text of any message Zendesk tags as
csatwith our own copy. Two different messages carrying that tag come out the other side indistinguishable. Rather than guess how many prompts Zendesk will send — which changes with the CSAT migration in SUTO-1421 — the chat now renders the latest one and ignores the rest.Testing Instructions
yarn startand open the Help Center on a Simple site.