-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Avoid adding props to global function prototype. Doing so breaks the react-three-fiber reconciler #9207
base: master
Are you sure you want to change the base?
Conversation
…react-three-fiber reconciler and prevents it from detecting when event handlers have changed and need to be updated in the underlying three.js objects.
There do seem to be some relevant failing tests, does |
The failing tests I saw on the CI build related to missing image files. If I run
|
Playing with this a bit further, It's starting to look like deck.gl requires attaching props to the global function prototype in order for the layer tests to pass - something that is incompatible with the way the react-three-fiber reconciler works. I need to spend more time familiarising myself with the deck.gl code and what role props play. |
@marsy-invests Can you pinpoint in the debugger when the function prototype is polluted? Perhaps add a |
@ibgreen if I change getPropsPrototype (see https://github.com/visgl/deck.gl/blob/master/modules/core/src/lifecycle/create-props.ts#L82) to throw an error when about to pollute the function prototype as follows:
I get the following stack trace
|
And if I add
|
Revised the fix. It now passes the test suite. |
Closes #9206
Change List
createPropsPrototypeAndTypes
to bail out if the parent class of the passed component class is the global function prototype so that it doesn't get polluted.There may well be a better and cleaner way to do this, but this fixes the bug I'm experiencing.
Note that I was not able to get tests to run locally or on my fork via Github Actions, but the errors appear unrelated to my changes and seem to be occurring on some workflow runs on the main repo.
P.S. deck.gl is an absolutely amazing piece of software!