Add nullcheck for `window.event`
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:
- https://github.com/facebook/react/issues/24778
- https://github.com/facebook/react/issues/25664
- https://github.com/facebook/react/pull/25670
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 |
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!
Comparing: f994737d14e83f22ead70e6a41f87353008b73cf...6cce2b39ec527c87f8de4d2aa4ef66604cc7dce7
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 :no_entry_sign: dangerJS against 6cce2b39ec527c87f8de4d2aa4ef66604cc7dce7
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!
@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.
@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!