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

Remove patch of window.Promise.prototype.constructor #26

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

gzuidhof
Copy link
Contributor

I am not confident we can patch this constructor without causing issues down the line, be it in Angular or other libraries that mess with Promise - so I decided to remove it entirely.

I think one way that we could keep it would be to use Reflect.construct, but that doesn't have wide enough browser support (no IE11).

In other libraries where Promise was replaced entirely, such as in New Relic's browser agent [1] [2] it would subtly break existing website code. Now we only patch the constructor.. maybe there is some way, but I wasn't able to find a way that I'm confident in.

If we ever choose to re-introduce that, we must make sure to make that a major version bump.

@gzuidhof gzuidhof added the bug Something isn't working label Dec 11, 2024
@gzuidhof gzuidhof requested a review from greenberga December 11, 2024 12:10
@gzuidhof gzuidhof self-assigned this Dec 11, 2024
Copy link
Contributor

@greenberga greenberga left a comment

Choose a reason for hiding this comment

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

Go for it—to be honest, I don't have a strong enough intuition for how this might impact our signals pipeline because I don't have a great sense of how it uses the information. So I'm deferring to you. But generally, I'm in favor of minimizing tracking where possible :)

@@ -79,7 +79,6 @@ export const takeRecords = (function () {

// We save some bundle size by using these constants.
Copy link
Contributor

Choose a reason for hiding this comment

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

Now I guess it's just "this constant", but feel free to ignore.

@gzuidhof gzuidhof merged commit c353534 into main Dec 11, 2024
2 checks passed
@gzuidhof gzuidhof deleted the remove-promise-patch branch December 11, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants