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

Add nullcheck for window.event #29234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

evankirkiles
Copy link

Summary

Adds a null check for window.event. Some browsers seem to be setting this value to null, which breaks the logic of this code snippet, leading to a huge amount of n.type could not be accessed because null is not an object errors.

See:

Copy link

vercel bot commented May 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2024 2:50pm

@facebook-github-bot
Copy link

Hi @evankirkiles!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@react-sizebot
Copy link

Comparing: f994737...6cce2b3

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.66 kB 6.66 kB = 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 495.89 kB 495.93 kB = 88.83 kB 88.83 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.67 kB 6.67 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 500.69 kB 500.73 kB = 89.51 kB 89.52 kB
facebook-www/ReactDOM-prod.classic.js = 593.05 kB 593.08 kB = 104.32 kB 104.33 kB
facebook-www/ReactDOM-prod.modern.js = 569.27 kB 569.31 kB = 100.72 kB 100.73 kB
test_utils/ReactAllWarnings.js Deleted 64.35 kB 0.00 kB Deleted 16.05 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js Deleted 64.35 kB 0.00 kB Deleted 16.05 kB 0.00 kB

Generated by 🚫 dangerJS against 6cce2b3

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@classicdocs
Copy link

@evankirkiles What is the reason for closing this PR ? I tried to migrate from react 17 to react 18 and in some cases I have issues with this.

@evankirkiles
Copy link
Author

@classicdocs Actually, I don't remember—I fixed where we were setting window.event to null in our codebase so didn't end up needing this fix, but I can imagine it might benefit others. Reopening!

@evankirkiles evankirkiles reopened this Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants