-
Notifications
You must be signed in to change notification settings - Fork 23
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
fix: Users unable to cancel when have adblock #3194
Conversation
return resolve() | ||
} | ||
|
||
script.onerror = function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to trigger the catch and "block" stuff in useBarecancel.js
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #3194 +/- ##
===========================================
Coverage 98.14000 98.14000
===========================================
Files 935 930 -5
Lines 14510 14456 -54
Branches 3968 3955 -13
===========================================
- Hits 14241 14188 -53
+ Misses 264 263 -1
Partials 5 5
... and 20 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
@@ Coverage Diff @@
## main #3194 +/- ##
==========================================
- Coverage 98.14% 98.14% -0.01%
==========================================
Files 935 930 -5
Lines 14510 14456 -54
Branches 3968 3950 -18
==========================================
- Hits 14241 14188 -53
+ Misses 264 263 -1
Partials 5 5
... and 20 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
@@ Coverage Diff @@
## main #3194 +/- ##
==========================================
- Coverage 98.14% 98.14% -0.01%
==========================================
Files 935 930 -5
Lines 14510 14456 -54
Branches 3941 3955 +14
==========================================
- Hits 14241 14188 -53
+ Misses 264 263 -1
Partials 5 5
... and 20 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3194 +/- ##
==========================================
- Coverage 98.14% 98.14% -0.01%
==========================================
Files 935 930 -5
Lines 14510 14456 -54
Branches 3886 3869 -17
==========================================
- Hits 14241 14188 -53
+ Misses 264 263 -1
Partials 5 5
... and 20 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Bundle ReportChanges will decrease total bundle size by 1.33kB (-0.02%) ⬇️. This is within the configured threshold ✅ Detailed changes
|
Bundle ReportChanges will increase total bundle size by 1.29kB ⬆️
|
✅ Deploy preview for gazebo ready!Previews expire after 1 month automatically.
|
if (unMounted) return | ||
setWasBlocked(false) | ||
}) | ||
.catch(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only diff here is to set blocked to true if we have an error
@@ -8,17 +8,22 @@ export function getEndPeriod(unixPeriodEnd) { | |||
} | |||
|
|||
export function loadBaremetrics() { | |||
return new Promise((resolve) => { | |||
if (window.barecancel && window.barecancel.created) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize til this morning that we were incorrectly resolving this promise when we shouldn't have been because this attribute was in the DOM but didn't actually mean the script was "working"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
PROBLEM
Today I learned that scripts have .onload() and .onerror() handlers that allow you to throw errors if they aren't injected properly into the DOM!
Previously we were relying on doing all of that on "our own" in a bit of a hacky way; and it turns out just relying on those aspects and removing the unneeded code was all we needed to get baremetrics to work with and without adblock.
References:
https://app.baremetrics.com/cancellations/configure/responses/widget/embed-code
https://help.baremetrics.com/en/articles/5380579-embedding-cancellation-insights-code
https://help.baremetrics.com/en/articles/5380562-cancellation-insights-your-101-setup-guide
Closes codecov/engineering-team#2512
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.