Unverified Commit c7893011 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Removng prop writable checking in prod (#31929)

x-ref: #28498, #31784

I can repro the issue #24783 with `next-boost` 0.10.1 and it was fixed in 0.10.2 (ref: https://github.com/rjyo/next-boost/commit/eba6d10aabb2470ec5d7bd48ac8fec4ea08e26c5). The actual case is missing setting node env to `"production"`.

React freeze element props and element itself in dev mode (ref: https://github.com/facebook/react/blob/a724a3b578dce77d427bef313102a4d0e978d9b4/packages/react/src/ReactElement.js#L194-L196)

Then next.js will reassign props with react development bundle while next-boost is enabled. Those operations are only happened in non-dev mode so it's good to remove now.

This PR + #31898 == revert #31784

cc @styfle @awareness481
parent 0ef87397
...@@ -458,11 +458,7 @@ export class Head extends Component< ...@@ -458,11 +458,7 @@ export class Head extends Component<
newProps['data-href'] = newProps['href'] newProps['data-href'] = newProps['href']
newProps['href'] = undefined newProps['href'] = undefined
return React.cloneElement(c, newProps) return React.cloneElement(c, newProps)
} else if ( } else if (c.props && c.props['children']) {
c.props &&
c.props['children'] &&
Object.getOwnPropertyDescriptor(c.props, 'children')?.writable
) {
c.props['children'] = this.makeStylesheetInert(c.props['children']) c.props['children'] = this.makeStylesheetInert(c.props['children'])
} }
return c return c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment