-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Read constructor name more carefully #29954
Conversation
Sometimes `constructor` happens to be the name of an unrelated property, or we may be dealing with a `Proxy` that intercepts every read. Verify the constructor is a function before using its name, and reset the name anyway if it turns out not to be serializable. Fixes some cases of the devtools crashing and becoming inoperable upon attempting to inspect components whose props are Hookstate `State`s.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hi @LoganDark! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Thanks for upstreaming this, I have a few questions:
|
I'm not sure. I don't really have much time to do that right now, though. I don't imagine it'd be hard, just pass a prop that is
AFAIK it could be a proxy pretending to be string. It's not really the type that we need to check here, it's whether trying to send it over the bridge would throw exceptions. Of course we could probably put a try/catch around each attempt to send a message as well so that unserializable messages don't permanently brick the queue. |
I think the change makes sense overall, but I would prefer us to be more conservative about the the
I am not sure if you can actually implement a proxy that would override Would you be able to update the PR accordingly? |
You mean to just check if the type is |
Yes. |
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. Thanks for fixing this.
Please fix the linter issues, and then we can merge this.
Ugh, it's another format checker that doesn't provide a diff. (Actually, I think it's always been I suppose I can do that next Monday when I have access to a terminal. I could've done it now if I had a diff, but if I have to clone the repo to my local machine and run a command on it, I can't do that until next Monday since I'm off this week. I can't even imagine what prettier might be getting upset about anyway. |
yeah okay, I truly have no clue what Prettier is getting upset about. I guess I'll properly run the command next Monday. And maybe then I'll open another PR to fix your CI (or open a PR to Prettier to fix their project), as it's really supposed to be providing a diff. (apologies if this comes off as rude, I mean nothing by it. just frustrated by this having happened multiple times, i.e. having to clone a repo to my computer just to run the stupid formatter because the CI complains that something is wrong without telling me what.) (and update: looks like it is an issue with Prettier itself, go figure. Not your fault then.) |
thanks! |
## Summary Full list of changes, mostly fixes: * chore[react-devtools/renderer]: dont show strict mode warning for prod renderer builds ([hoxyq](https://github.com/hoxyq) in [#30158](#30158)) * chore[react-devtools/ui]: fix strict mode badge styles ([hoxyq](https://github.com/hoxyq) in [#30159](#30159)) * fix[react-devtools]: restore original args when recording errors ([hoxyq](https://github.com/hoxyq) in [#30091](#30091)) * Read constructor name more carefully ([LoganDark](https://github.com/LoganDark) in [#29954](#29954)) * refactor[react-devtools/extensions]: dont debounce cleanup logic on navigation ([hoxyq](https://github.com/hoxyq) in [#30027](#30027)) * lint: enable reportUnusedDisableDirectives and remove unused suppressions ([kassens](https://github.com/kassens) in [#28721](#28721)) * fix[react-devtools/extensions]: propagate globals from env ([hoxyq](https://github.com/hoxyq) in [#29963](#29963)) * refactor[react-devtools/tests]: use registered marks instead of cleared in tests ([hoxyq](https://github.com/hoxyq) in [#29929](#29929))
Summary
Sometimes
constructor
happens to be the name of an unrelated property, or we may be dealing with aProxy
that intercepts every read. Verify the constructor is a function before using its name, and reset the name anyway if it turns out not to be serializable.Fixes some cases of the devtools crashing and becoming inoperable upon attempting to inspect components whose props are Hookstate
State
s.How did you test this change?
Installed a patched version of the extension and confirmed that it solves the problem.