Skip to content

fix(feedback): Be consistent about whether screenshot should and can render #11859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions packages/feedback/src/core/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,25 +176,33 @@ export const buildFeedbackIntegration = ({
};

const _loadAndRenderDialog = async (options: FeedbackInternalOptions): Promise<FeedbackDialog> => {
const screenshotRequired = options.showScreenshot && isScreenshotSupported();
const [modalIntegration, screenshotIntegration] = await Promise.all([
_findIntegration<FeedbackModalIntegration>('FeedbackModal', getModalIntegration, 'feedbackModalIntegration'),
showScreenshot && isScreenshotSupported()
screenshotRequired
? _findIntegration<FeedbackScreenshotIntegration>(
'FeedbackScreenshot',
getScreenshotIntegration,
'feedbackScreenshotIntegration',
)
: undefined,
]);
if (!modalIntegration || (showScreenshot && !screenshotIntegration)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line was preventing the modal from rendering on a real mobile device if showScreenshot:true was set.

why?
we asked for screenshots,
but it's not supported, so we didn't load it
and this like says "we expected it to be loaded, but it's not"

fixed now!

if (!modalIntegration) {
// TODO: Let the end-user retry async loading
// Include more verbose logs so developers can understand the options (like preloading).
throw new Error('Missing feedback helper integration!');
DEBUG_BUILD &&
logger.error(
'[Feedback] Missing feedback modal integration. Try using `feedbackSyncIntegration` in your `Sentry.init`.',
);
throw new Error('[Feedback] Missing feedback modal integration!');
}
if (screenshotRequired && !screenshotIntegration) {
DEBUG_BUILD &&
logger.error('[Feedback] Missing feedback screenshot integration. Proceeding without screenshots.');
}

return modalIntegration.createDialog({
options,
screenshotIntegration: showScreenshot ? screenshotIntegration : undefined,
screenshotIntegration: screenshotRequired ? screenshotIntegration : undefined,
sendFeedback,
shadow: _createShadow(options),
});
Expand Down
Loading