File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed 
examples/basic/src/routes/hmr-shared/atomic Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ export function TestClient({
99  testSharedFromServer : string 
1010} )  { 
1111  React . useEffect ( ( )  =>  { 
12-     console . log ( {  testShared,  testSharedFromServer } ) 
1312    if  ( testShared  !==  testSharedFromServer )  { 
13+       console . log ( {  testShared,  testSharedFromServer } ) 
1414      throw  new  Error ( 
1515        `Mismatch: ${ JSON . stringify ( {  testShared,  testSharedFromServer } ) }  ` , 
1616      ) 
Original file line number Diff line number Diff line change @@ -836,7 +836,7 @@ window.__vite_plugin_react_preamble_installed__ = true;
836836const ssrCss = document.querySelectorAll("link[rel='stylesheet']"); 
837837import.meta.hot.on("vite:beforeUpdate", () => { 
838838  ssrCss.forEach(node => { 
839-     if (node.dataset.precedence?.startsWith( "vite-rsc/") ) { 
839+     if (node.dataset.precedence ===  "vite-rsc/client-reference" ) { 
840840      node.remove(); 
841841    } 
842842  }); 
@@ -1910,6 +1910,20 @@ export function vitePluginRscCss(
19101910          // ensure hmr boundary at this virtual since otherwise non-self accepting css 
19111911          // (e.g. css module) causes full reload 
19121912          code  +=  `if (import.meta.hot) { import.meta.hot.accept() }\n` 
1913+           // remove server rendered <link> after inline <style> is injected on client 
1914+           // to avoid duplicate styles 
1915+           function  removeFn ( hrefs : string [ ] )  { 
1916+             for  ( const  href  of  hrefs )  { 
1917+               const  el  =  document . querySelector ( 
1918+                 `link[rel="stylesheet"][href="${ href }  "]` , 
1919+               ) 
1920+               console . log ( {  href,  el } ) 
1921+               if  ( el )  { 
1922+                 el . remove ( ) 
1923+               } 
1924+             } 
1925+           } 
1926+           code  +=  `(${ removeFn . toString ( ) }  )(${ JSON . stringify ( result . hrefs ) }  );\n` 
19131927          return  code 
19141928        } 
19151929      } , 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments