Skip to content
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

feat(feedback): Flush replays when feedback form opens #10567

Merged
merged 7 commits into from Feb 29, 2024

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Feb 8, 2024

Flush replay when the feedback form is first opened instead of at submit time

We are making this change because we have noticed a lot of feedback replays only consist of the user submitting the feedback and not what they did prior to submitting feedback. This may result in false positives if users open but do not submit feedback, but this should make replays from feedback more useful.

Copy link
Contributor

github-actions bot commented Feb 8, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 77.35 KB (+0.25% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 68.57 KB (+0.22% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped) 72.51 KB (+0.23% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 62.12 KB (+0.24% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 32.8 KB (+0.46% 🔺)
@sentry/browser (incl. browserTracingIntegration) - Webpack (gzipped) 32.8 KB (+0.46% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 31.01 KB (+0.66% 🔺)
@sentry/browser (incl. sendFeedback) - Webpack (gzipped) 31.01 KB (+0.66% 🔺)
@sentry/browser - Webpack (gzipped) 22.25 KB (+0.72% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 75.79 KB (+0.28% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 67.42 KB (+0.24% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 33.26 KB (+0.51% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 24.76 KB (+0.72% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 211.01 KB (+0.13% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 99.74 KB (+0.29% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 74 KB (+0.49% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 36.32 KB (+0.43% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 68.84 KB (+0.2% 🔺)
@sentry/react - Webpack (gzipped) 22.28 KB (+0.72% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 85.32 KB (+0.16% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.66 KB (+0.29% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 17.09 KB (+0.31% 🔺)

@billyvg billyvg force-pushed the feat-feedback-flush-replay-on-form-open branch 2 times, most recently from 3f23a50 to 4069cf5 Compare February 20, 2024 21:42
packages/feedback/src/integration.ts Outdated Show resolved Hide resolved
packages/feedback/src/integration.ts Outdated Show resolved Hide resolved
@billyvg billyvg force-pushed the feat-feedback-flush-replay-on-form-open branch from 3094032 to bc31cf3 Compare February 21, 2024 17:12
…form open

* By default (can be disabled), if replay integration exists, start buffering
* Flush replay when the feedback form is first opened instead of at submit time

We are making this change because we have noticed a lot of feedback replays only consist of the user submitting the feedback and not what they did prior to submitting feedback. This may result in false positives if users open but do not submit feedback, but this should make replays from feedback more useful.
@billyvg billyvg force-pushed the feat-feedback-flush-replay-on-form-open branch from bc31cf3 to c45d03f Compare February 21, 2024 19:35
@billyvg billyvg requested a review from mydea February 21, 2024 19:49
@billyvg billyvg marked this pull request as ready for review February 21, 2024 19:49
@@ -1,4 +1,5 @@
import type { Integration, IntegrationFn } from '@sentry/types';
import { type replayIntegration } from '@sentry/replay';
Copy link
Member

Choose a reason for hiding this comment

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

let's not use this syntax, but import type {} - I've read that this is better/easier to treeshake!

Also, generally, I'd say maybe we should avoid this - we have this as devDependency only for the type here, which is not really correct from a bundling perspective 😬 I'd rather we just inline the relevant type here (or if really needed put some interface type in @sentry/types that both packages can use)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wouldn't inlining defeat the purpose of typechecking against replay interface? (in this case, it probably wouldn't matter too much, but just trying to think of a good general solution).

I guess the best solution here is to extract it into types, but it's still a bit annoying having to duplicate the type

Copy link
Member

Choose a reason for hiding this comment

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

yeah, that's always the problem with the types stuff and the circular dependency stuff 😬

So I'd go with one of these approaches - no strong feelings:

  1. We add a minimal interface to types - IMHO that may be OK to do for the integration itself, as the surface is quite small and can be considered the public contract. then in replay we can do class Replay implements ReplayIntegrationInterface or something like this 🤔
  2. We inline the styles, which is obv. not super secure but probably OK/fine here (as tests would fail anyhow hopefully if that would change), and we only use a single method right now?

@billyvg billyvg changed the title feat(feedback): Auto start buffering replays if enabled and flush on form open feat(feedback): Flush replays when feedback form opens Feb 29, 2024
@billyvg billyvg requested a review from mydea February 29, 2024 16:02
@billyvg billyvg merged commit 3cb5108 into develop Feb 29, 2024
93 checks passed
@billyvg billyvg deleted the feat-feedback-flush-replay-on-form-open branch February 29, 2024 18:51
AbhiPrasad pushed a commit that referenced this pull request Feb 29, 2024
Flush replay when the feedback form is first opened instead of at submit
time

We are making this change because we have noticed a lot of feedback
replays only consist of the user submitting the feedback and not what
they did prior to submitting feedback. This may result in false
positives if users open but do not submit feedback, but this should make
replays from feedback more useful.
AbhiPrasad pushed a commit that referenced this pull request Feb 29, 2024
Flush replay when the feedback form is first opened instead of at submit
time

We are making this change because we have noticed a lot of feedback
replays only consist of the user submitting the feedback and not what
they did prior to submitting feedback. This may result in false
positives if users open but do not submit feedback, but this should make
replays from feedback more useful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants