-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Check write-access on prototype. #818
Conversation
return descr.writable ? obj : null | ||
} | ||
const proto = Object.getPrototypeOf(obj) | ||
return proto ? getWritableProto(proto, p) : null |
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.
What is this for ?
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.
This traverses the prototype chain, returning the prototype object on which the property is defined. getOwnPropertyDescriptor
returns the descriptor for the immediate/own properties only.
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.
Could we add a comment in the code to explain the motivation for this? Since it's a bit obscure
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.
@rauchg ok?
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.
@dbo could you resolve the merge conflict ❤️ |
* zeit/master: (25 commits) Wrap render method created using class properties (2) (#856) Add Apollo example (#780) tweak font sizes again 🙈 Fix error fonts (#826) chore(package): update husky to version 0.13.0 (#853) Update styled-component docs (#841) Use ErrorDebug component on error of react-hot-loader (#852) Release 2.0.0-beta.18 bump `styled-jsx` chore(package): update styled-jsx to version 0.4.5 (#847) Make sure lastAppProps always have some value. (#829) chore(package): update babel-generator to version 6.22.0 (#833) chore(package): update babel-plugin-transform-async-to-generator to version 6.22.0 (#834) chore(package): update babel-plugin-transform-class-properties to version 6.22.0 (#835) chore(package): update babel-plugin-transform-object-rest-spread to version 6.22.0 (#836) chore(package): update babel-plugin-transform-runtime to version 6.22.0 (#837) chore(package): update babel-preset-es2015 to version 6.22.0 (#838) chore(package): update babel-preset-react to version 6.22.0 (#839) chore(package): update babel-runtime to version 6.22.0 (#840) chore(package): update babel-core to version 6.22.1 (#842) ... # Conflicts: # client/patch-react.js
I didn't aware of this PR. In my PR, if we can't override render method in the prototype stage, we'll do it in the runtime. Anyway, I'd like to take either one before we release 2.0 |
I also would be grateful if this issue would be resolved properly soon. It hinders us from progressing, still on an oudated 2.0-beta due to this issue. |
Sorry, I don't really understand the full scope of your change, and have to admit I don't really have much time for this problem. I am just eagerly waiting for: a) turn patching off by next.config or the like or b) check for write-access. |
@dbo Okay I will work on it. I will take your changes into it. |
Stats from current PRDefault Server ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Rendered Page Sizes
Serverless ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Serverless bundles
Commit: 3762e75 |
This PR adds a check whether the targeted prototype's render is writable before patching it.