Skip to content

Commit d996c22

Browse files
fix(feedback): Call dialog.close() in dialog close callbacks in _loadAndRenderDialog (#13203)
This PR updates `_loadAndRenderDialog` to call `dialog.close()` in the `onFormClose` and `onFormSubmitted` callbacks.
2 parents 4ddc7eb + 7be412c commit d996c22

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

packages/feedback/src/core/integration.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,24 @@ export const buildFeedbackIntegration = ({
209209
logger.error('[Feedback] Missing feedback screenshot integration. Proceeding without screenshots.');
210210
}
211211

212-
return modalIntegration.createDialog({
213-
options,
212+
const dialog = modalIntegration.createDialog({
213+
options: {
214+
...options,
215+
onFormClose: () => {
216+
dialog && dialog.close();
217+
options.onFormClose && options.onFormClose();
218+
},
219+
onFormSubmitted: () => {
220+
dialog && dialog.close();
221+
options.onFormSubmitted && options.onFormSubmitted();
222+
},
223+
},
214224
screenshotIntegration: screenshotRequired ? screenshotIntegration : undefined,
215225
sendFeedback,
216226
shadow: _createShadow(options),
217227
});
228+
229+
return dialog;
218230
};
219231

220232
const _attachTo = (el: Element | string, optionOverrides: OverrideFeedbackConfiguration = {}): Unsubscribe => {
@@ -233,10 +245,6 @@ export const buildFeedbackIntegration = ({
233245
if (!dialog) {
234246
dialog = await _loadAndRenderDialog({
235247
...mergedOptions,
236-
onFormClose: () => {
237-
dialog && dialog.close();
238-
mergedOptions.onFormClose && mergedOptions.onFormClose();
239-
},
240248
onFormSubmitted: () => {
241249
dialog && dialog.removeFromDom();
242250
mergedOptions.onFormSubmitted && mergedOptions.onFormSubmitted();

0 commit comments

Comments
 (0)