8000 Move dialog.close() call into _loadAndRenderDialog · benjick/sentry-javascript@841d57c · GitHub
[go: up one dir, main page]

Skip to content

Commit 841d57c

Browse files
committed
Move dialog.close() call into _loadAndRenderDialog
1 parent f9a040a commit 841d57c

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

packages/feedback/src/core/integration.ts

Lines changed: 16 additions & 18 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 => {
@@ -234,7 +246,7 @@ export const buildFeedbackIntegration = ({
234246
dialog = await _loadAndRenderDialog({
235247
...mergedOptions,
236248
onFormClose: () => {
237-
dialog && dialog.close();
249+
dialog && dialog.removeFromDom();
238250
mergedOptions.onFormClose && mergedOptions.onFormClose();
239251
},
240252
onFormSubmitted: () => {
@@ -318,21 +330,7 @@ export const buildFeedbackIntegration = ({
318330
async createForm(
319331
optionOverrides: OverrideFeedbackConfiguration = {},
320332
): Promise<ReturnType<FeedbackModalIntegration['createDialog']>> {
321-
const mergedOptions = mergeOptions(_options, optionOverrides);
322-
323-
const dialog = await _loadAndRenderDialog({
324-
...mergedOptions,
325-
onFormClose: () => {
326-
dialog && dialog.close();
327-
mergedOptions.onFormClose && mergedOptions.onFormClose();
328-
},
329-
onFormSubmitted: () => {
330-
dialog && dialog.close();
331-
mergedOptions.onFormSubmitted && mergedOptions.onFormSubmitted();
332-
},
333-
});
334-
335-
return dialog;
333+
return _loadAndRenderDialog(mergeOptions(_options, optionOverrides));
336334
},
337335

338336
/**

0 commit comments

Comments
 (0)
0