fix: Finalize survey#1276
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the survey completion flow to call the new “finalize” endpoint when a survey is completed, and bumps the @equinor/subsurface-app-management dependency accordingly.
Changes:
- Add
useCompleteActiveSurveyusage and invoke completion finalize when finishing the last question. - Update Storybook MSW handlers to mock the new finalize endpoint.
- Minor robustness tweak in
SurveyDialogto always reset loading state, plus dependency/lockfile updates.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/providers/SurveyProvider/SurveyProvider.tsx |
Calls the new finalize/completion mutation when completing a survey. |
src/providers/SurveyProvider/SurveyProvider.stories.tsx |
Adds an MSW handler for the finalize endpoint used during completion. |
src/providers/SurveyProvider/SurveyDialog/SurveyDialog.tsx |
Ensures isAnswering is reset via try/finally around answer submission. |
public/mockServiceWorker.js |
Updates MSW worker package version constant (generated artifact). |
package.json |
Bumps library version and @equinor/subsurface-app-management to 5.4.7. |
bun.lock |
Lockfile refresh reflecting dependency bumps (including MSW). |
Comments suppressed due to low confidence (1)
src/providers/SurveyProvider/SurveyProvider.tsx:100
completeSurvey(...)is triggered and a success toast/confetti is shown immediately, regardless of whether the finalize request succeeds or fails. To avoid false-positive UX, wire the toast/confetti to the mutation success callback (or usemutateAsync+ try/catch), and show an error toast on failure.
completeSurvey(activeSurvey.surveyResponseId.value);
showToast({
variant: 'success',
title: 'Survey completed',
description: 'Thanks for helping us improve!',
duration: 5,
});
if (activeSurvey.showConfettiOnComplete) {
shower({
mode: 'shower',
shapes: ['square'],
duration: 5000,
});
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
arkadiy93
previously approved these changes
Apr 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/providers/SurveyProvider/SurveyProvider.tsx:92
completeSurvey(...)is fired and a success toast is shown immediately without waiting for the finalize mutation to succeed (and without any error handling). This can show “Survey completed” even if the request fails. Prefer awaiting the mutation (e.g.,mutateAsync) or moving the toast/confetti into the mutation’sonSuccess, and showing an error toast ononError.
completeSurvey(activeSurvey.surveyResponseId.value);
showToast({
variant: 'success',
title: 'Survey completed',
description: 'Thanks for helping us improve!',
duration: 5,
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
Call the new finalize endpoint when completing a survey