fix: Show success message after feedback submission#3609
fix: Show success message after feedback submission#3609
Conversation
Display a success screen with successMessageText after feedback is submitted. The form is replaced with a checkmark icon and success message that auto-dismisses after 5 seconds or on tap. Adds `successColor` and `onSubmitSuccess` callback to `SentryFeedbackOptions`.
Android Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| cfca825 | 417.36 ms | 393.37 ms | -23.99 ms |
| 51520fc | 351.89 ms | 349.79 ms | -2.10 ms |
| 75284dc | 512.39 ms | 530.87 ms | 18.48 ms |
| a909995 | 383.55 ms | 370.78 ms | -12.77 ms |
| f761369 | 462.73 ms | 563.80 ms | 101.06 ms |
| 575ebaa | 478.00 ms | 585.76 ms | 107.76 ms |
| a5b28db | 383.85 ms | 387.65 ms | 3.80 ms |
| e5b87f8 | 371.22 ms | 377.22 ms | 6.00 ms |
| c8596a6 | 474.00 ms | 492.96 ms | 18.96 ms |
| 79f6b41 | 469.66 ms | 525.90 ms | 56.24 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| cfca825 | 14.09 MiB | 15.28 MiB | 1.19 MiB |
| 51520fc | 13.93 MiB | 15.18 MiB | 1.25 MiB |
| 75284dc | 13.93 MiB | 14.93 MiB | 1.00 MiB |
| a909995 | 14.09 MiB | 15.28 MiB | 1.19 MiB |
| f761369 | 6.54 MiB | 7.70 MiB | 1.16 MiB |
| 575ebaa | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| a5b28db | 13.93 MiB | 15.18 MiB | 1.25 MiB |
| e5b87f8 | 13.93 MiB | 15.18 MiB | 1.25 MiB |
| c8596a6 | 6.54 MiB | 7.53 MiB | 1015.27 KiB |
| 79f6b41 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
iOS Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 51520fc | 1253.87 ms | 1254.87 ms | 1.00 ms |
| 0e2b9b0 | 1248.69 ms | 1252.22 ms | 3.54 ms |
| c8596a6 | 1234.11 ms | 1241.19 ms | 7.08 ms |
| bfabaf2 | 1251.72 ms | 1253.38 ms | 1.67 ms |
| 29e8ebe | 1260.46 ms | 1262.60 ms | 2.14 ms |
| 1777727 | 1249.21 ms | 1258.40 ms | 9.18 ms |
| 6b69699 | 1254.80 ms | 1273.31 ms | 18.52 ms |
| e3f3ea1 | 1262.83 ms | 1264.83 ms | 1.99 ms |
| 827bf09 | 1261.86 ms | 1276.41 ms | 14.55 ms |
| 944b773 | 1252.82 ms | 1254.08 ms | 1.27 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 51520fc | 5.53 MiB | 5.96 MiB | 443.39 KiB |
| 0e2b9b0 | 5.73 MiB | 6.17 MiB | 453.79 KiB |
| c8596a6 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| bfabaf2 | 5.53 MiB | 6.01 MiB | 487.95 KiB |
| 29e8ebe | 5.53 MiB | 6.01 MiB | 488.12 KiB |
| 1777727 | 5.73 MiB | 6.17 MiB | 453.78 KiB |
| 6b69699 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| e3f3ea1 | 5.53 MiB | 5.96 MiB | 443.28 KiB |
| 827bf09 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 944b773 | 5.53 MiB | 6.00 MiB | 479.98 KiB |
Sentry Build Distribution
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3609 +/- ##
==========================================
+ Coverage 88.12% 91.04% +2.92%
==========================================
Files 304 95 -209
Lines 10372 3262 -7110
==========================================
- Hits 9140 2970 -6170
+ Misses 1232 292 -940 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| if (mounted && _submitted) { | ||
| _dismiss(pendingAssociatedEventId: false); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Success message shown even when feedback capture fails
Medium Severity
The _submit method shows the success UI and invokes onSubmitSuccess without checking whether _captureFeedback actually succeeded. captureFeedback on the hub returns SentryId.empty() when the instance is disabled or when capture throws an exception. The established SDK pattern (visible in example_web/web/main.dart) is to check sentryId != SentryId.empty() before treating a capture as successful. Without this guard, users see "Thank you for your report!" and the onSubmitSuccess callback fires even when their feedback was silently dropped.
There was a problem hiding this comment.
The problem is, that we effectively do not get negative. We send an envelope to JS/Android/iOS downstream SDK. The modal is closed in any case.
|
|
||
| if (!mounted) return; | ||
|
|
||
| widget.options.onSubmitSuccess?.call(feedback, sentryId); |
There was a problem hiding this comment.
Bug: The onSubmitSuccess callback is invoked and the success UI is shown even when feedback submission fails, as there is no check for a returned SentryId.empty().
Severity: MEDIUM
Suggested Fix
Check the sentryId returned from _captureFeedback. Only call onSubmitSuccess and set the state to _submitted = true if the sentryId is not equal to SentryId.empty(). Consider handling the failure case, for example by not indicating success.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: packages/flutter/lib/src/feedback/sentry_feedback_widget.dart#L442
Potential issue: The `_captureFeedback` function can return `SentryId.empty()` if the
feedback event is dropped for various reasons, such as by a `beforeSendFeedback`
callback or a transport failure. The code unconditionally calls the `onSubmitSuccess`
callback and updates the UI to a success state immediately after `_captureFeedback`
returns, without checking the validity of the returned `sentryId`. This misleads both
the developer using the callback and the end-user, as they are informed of a success
when the submission may have actually failed.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
The problem is, that we effectively do not get negative. We send an envelope to JS/Android/iOS downstream SDK. The modal is closed in any case.
There was a problem hiding this comment.
@denrase can you check if captureEnvelope in the native sdks returned an empty id if that equals to sending failed?
There was a problem hiding this comment.
for JS it's a bit trickier yea, afaict their sendEnvelope doesn't return any id
There was a problem hiding this comment.
they do not, we get a valid id. initially i also had onError callbacks in this pr, but i abandoned them because of this behaviour


📜 Description
Display a success screen with successMessageText after feedback is submitted. The form is replaced with a checkmark icon and success message that auto-dismisses after 5 seconds or on tap. Adds
successColorandonSubmitSuccesscallback toSentryFeedbackOptions.💡 Motivation and Context
Closes #3583
💚 How did you test it?
📝 Checklist
sendDefaultPiiis enabled