File tree Expand file tree Collapse file tree 2 files changed +4
-14
lines changed
packages/qwik/src/core/qrl Expand file tree Collapse file tree 2 files changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,6 @@ export const loadBundleGraph = (element: Element) => {
103103
104104// we stringify this in prefetch-implementation.ts
105105export const makeMakePreloadLink =
106- /*@__PURE__ */
107106 ( canModulePreload : boolean | null ) => ( url : string , priority : boolean ) => {
108107 const link = document . createElement ( 'link' ) ;
109108 if ( canModulePreload === null ) {
@@ -119,16 +118,16 @@ export const makeMakePreloadLink =
119118 if ( ! canModulePreload ) {
120119 link . as = 'script' ;
121120 }
121+ link . onload = link . onerror = ( ) => link . remove ( ) ;
122+
122123 document . head . appendChild ( link ) ;
123124 } ;
124- const makePreloadLink = makeMakePreloadLink ( null ) ;
125+ const makePreloadLink = /* @__PURE__ */ makeMakePreloadLink ( null ) ;
125126
126127const prioritizeLink = ( url : string ) => {
127128 const link = document . querySelector ( `link[href="${ url } "]` ) as HTMLLinkElement | null ;
128129 if ( link ) {
129130 link . fetchPriority = 'high' ;
130- } else {
131- console . warn ( `Preload link ${ url } not found` ) ;
132131 }
133132} ;
134133
Original file line number Diff line number Diff line change @@ -42,15 +42,6 @@ test.describe("container", () => {
4242 const hash = await container . getAttribute ( "q:manifest-hash" ) ;
4343 const bundleLink = page . locator ( `link#qwik-bg-${ hash } ` ) . first ( ) ;
4444 await expect ( bundleLink ) . toHaveAttribute ( "href" ) ;
45-
46- const headPreload = page . locator ( `head > link[rel="modulepreload"]` ) ;
47- const beforeCount = await headPreload . count ( ) ;
48-
49- const anchor = container . locator ( "a" ) ;
50- await anchor . click ( ) ;
51- await expect ( anchor ) . toHaveText ( "2 / 3" ) ;
52-
53- const afterCount = await headPreload . count ( ) ;
54- expect ( afterCount ) . toBeGreaterThan ( beforeCount ) ;
45+ // We don't have a way to check if other modules are preloaded, because the link goes away
5546 } ) ;
5647} ) ;
You can’t perform that action at this time.
0 commit comments