React version: current main (d5736f098edee62c44f27b053e6e48f5fa443803 locally)
Steps To Reproduce
- Render a component on the server with two
ReactDOM.preloadModule() calls that use the same non-default as value:
function App() {
ReactDOM.preloadModule('worker-a', {as: 'serviceworker'});
ReactDOM.preloadModule('worker-b', {as: 'serviceworker'});
return <div>hello</div>;
}
renderToPipeableStream(<App />).pipe(writable);
- Let the Fizz render run.
Link to code example: minimal reproduction above; this is also covered by the added regression test in packages/react-dom/src/__tests__/ReactDOMFloat-test.js.
The current behavior
The second call crashes during server rendering:
TypeError: Cannot read properties of undefined (reading 'hasOwnProperty')
The repeated custom-as path checks moduleUnknownResources but then reads the bucket from unknownResources, so the bucket can be undefined.
The expected behavior
Fizz should track repeated custom module preload as values in moduleUnknownResources and emit both module preload links without crashing.
React version: current
main(d5736f098edee62c44f27b053e6e48f5fa443803locally)Steps To Reproduce
ReactDOM.preloadModule()calls that use the same non-defaultasvalue:Link to code example: minimal reproduction above; this is also covered by the added regression test in
packages/react-dom/src/__tests__/ReactDOMFloat-test.js.The current behavior
The second call crashes during server rendering:
The repeated custom-
aspath checksmoduleUnknownResourcesbut then reads the bucket fromunknownResources, so the bucket can be undefined.The expected behavior
Fizz should track repeated custom module preload
asvalues inmoduleUnknownResourcesand emit both module preload links without crashing.