Skip to content

Commit

Permalink
Call dialog.close() in onFormClose and onFormSubmitted callbacks for …
Browse files Browse the repository at this point in the history
…createForm forms
  • Loading branch information
spalmurray-codecov committed Aug 2, 2024
1 parent b4a9970 commit d866011
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/feedback/src/core/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,21 @@ export const buildFeedbackIntegration = ({
async createForm(
optionOverrides: OverrideFeedbackConfiguration = {},
): Promise<ReturnType<FeedbackModalIntegration['createDialog']>> {
return _loadAndRenderDialog(mergeOptions(_options, optionOverrides));
const mergedOptions = mergeOptions(_options, optionOverrides);

const dialog = await _loadAndRenderDialog({
...mergedOptions,
onFormClose: () => {
dialog && dialog.close();
mergedOptions.onFormClose && mergedOptions.onFormClose();
},
onFormSubmitted: () => {
dialog && dialog.close();
mergedOptions.onFormSubmitted && mergedOptions.onFormSubmitted();
},
});

return dialog;
},

/**
Expand Down

0 comments on commit d866011

Please sign in to comment.