Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Replacing an open feedback form can skip its wrapped onClose and leave an unsent saved score without onAfterSubmit, requiring lifecycle finalization and a regression test.
1 open issue
What changed in this PR
This PR centralizes the browser SDK’s feedback callback lifecycle so manual and automated forms report saved scores when users close without pressing Send.
Changes:
- Adds once-per-form notification handling, including pending saves and out-of-order score responses.
- Routes modal Escape cancellation through existing dismissal callbacks.
- Adds lifecycle regression tests, API documentation, and a patch changeset.
| File | Description |
|---|---|
packages/browser-sdk/test/feedbackSubmissionCallback.test.ts |
Tests notification timing, failures, and duplicate prevention. |
packages/browser-sdk/test/e2e/feedback-widget.browser.spec.ts |
Covers manual and automated submission and dismissal flows. |
packages/browser-sdk/src/ui/Dialog.tsx |
Handles native modal Escape cancellation. |
packages/browser-sdk/src/feedback/ui/withFeedbackSubmissionCallback.ts |
Implements the shared callback lifecycle. |
packages/browser-sdk/src/feedback/ui/types.ts |
Defines and documents the shared callback option. |
packages/browser-sdk/src/feedback/ui/index.ts |
Applies the lifecycle wrapper when opening forms. |
packages/browser-sdk/src/feedback/feedback.ts |
Removes automated feedback’s separate callback invocation. |
packages/browser-sdk/src/client.ts |
Passes manual feedback callbacks to the shared UI lifecycle. |
.changeset/friendly-feedback-close.md |
Documents the browser SDK patch. |
Review effort: Balanced
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.

Summary
Call
onAfterSubmitonce per feedback form: after Send, or on close with a saved score. Applies to both automated surveys andrequestFeedback().Kept four focused browser regressions per feedback source: score-only close, Send followed by auto-close, close during Send, and replacement during a score save. Removed the overlapping unit/browser matrix and the unrelated test-harness refactor. HTTP-failure handling is split into #799, based separately on
main.Verification
The declaration plugin still reports the previously verified baseline MSW
HttpResponsetest-type diagnostics; no new diagnostics were introduced.