Skip to content

Help Center: show one CSAT prompt per conversation - #113357

Merged
escapemanuele merged 2 commits into
trunkfrom
fix/duplicate-csat-message-suto-1454
Aug 7, 2026
Merged

Help Center: show one CSAT prompt per conversation#113357
escapemanuele merged 2 commits into
trunkfrom
fix/duplicate-csat-message-suto-1454

Conversation

@escapemanuele

@escapemanuele escapemanuele commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

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.

  • Applied in the Odie message cluster, which is what the Help Center chat renders.
  • getMessageUniqueIdentifier now 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 returned undefined for 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 csat with 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

  1. Run yarn start and open the Help Center on a Simple site.
  2. Start a chat and escalate to a Happiness Engineer.
  3. Have the resulting ticket solved so the CSAT prompt is sent to the conversation.
  4. Confirm the rating prompt appears once, below a single “Chat with support team ended” divider.
  5. Rate the chat and confirm the rating still submits, and that the prompt is replaced by the comment form as before.
  6. Reopen the Help Center and confirm the chat history renders unchanged: attachments, Happiness Engineer names, and the automated messages before and after the prompt.

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>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@escapemanuele
escapemanuele requested a review from Copilot August 6, 2026 17:27
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Aug 6, 2026
@escapemanuele
escapemanuele marked this pull request as ready for review August 6, 2026 17:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in packages/odie-client production code and can be a runtime compatibility footgun if this bundle is ever executed in browsers without at support (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 );

@escapemanuele
escapemanuele merged commit b8e6fd2 into trunk Aug 7, 2026
12 of 16 checks passed
@escapemanuele
escapemanuele deleted the fix/duplicate-csat-message-suto-1454 branch August 7, 2026 07:17
@github-actions github-actions Bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Aug 7, 2026
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.

3 participants