File tree Expand file tree Collapse file tree
react-dom-bindings/src/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6556,7 +6556,7 @@ function preloadModule(
65566556 resumableState . moduleUnknownResources . hasOwnProperty ( as ) ;
65576557 let resources ;
65586558 if ( hasAsType ) {
6559- resources = resumableState . unknownResources [ as ] ;
6559+ resources = resumableState . moduleUnknownResources [ as ] ;
65606560 if ( resources . hasOwnProperty ( key ) ) {
65616561 // we can return if we already have this resource
65626562 return;
Original file line number Diff line number Diff line change @@ -6532,6 +6532,34 @@ body {
65326532 ) ;
65336533 } ) ;
65346534
6535+ it ( 'preloads multiple non-script modules with the same as type' , async ( ) => {
6536+ function App ( ) {
6537+ ReactDOM . preloadModule ( 'serviceworker one' , { as : 'serviceworker' } ) ;
6538+ ReactDOM . preloadModule ( 'serviceworker two' , { as : 'serviceworker' } ) ;
6539+ return < div > hello</ div > ;
6540+ }
6541+
6542+ await act ( ( ) => {
6543+ renderToPipeableStream ( < App /> ) . pipe ( writable ) ;
6544+ } ) ;
6545+
6546+ expect ( getMeaningfulChildren ( document . body ) ) . toEqual (
6547+ < div id = "container" >
6548+ < link
6549+ rel = "modulepreload"
6550+ href = "serviceworker one"
6551+ as = "serviceworker"
6552+ />
6553+ < link
6554+ rel = "modulepreload"
6555+ href = "serviceworker two"
6556+ as = "serviceworker"
6557+ />
6558+ < div > hello</ div >
6559+ </ div > ,
6560+ ) ;
6561+ } ) ;
6562+
65356563 it ( 'warns if you provide invalid arguments' , async ( ) => {
65366564 function App ( ) {
65376565 ReactDOM . preloadModule ( ) ;
You can’t perform that action at this time.
0 commit comments