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) => {
103
103
104
104
// we stringify this in prefetch-implementation.ts
105
105
export const makeMakePreloadLink =
106
- /*@__PURE__ */
107
106
( canModulePreload : boolean | null ) => ( url : string , priority : boolean ) => {
108
107
const link = document . createElement ( 'link' ) ;
109
108
if ( canModulePreload === null ) {
@@ -119,16 +118,16 @@ export const makeMakePreloadLink =
119
118
if ( ! canModulePreload ) {
120
119
link . as = 'script' ;
121
120
}
121
+ link . onload = link . onerror = ( ) => link . remove ( ) ;
122
+
122
123
document . head . appendChild ( link ) ;
123
124
} ;
124
- const makePreloadLink = makeMakePreloadLink ( null ) ;
125
+ const makePreloadLink = /* @__PURE__ */ makeMakePreloadLink ( null ) ;
125
126
126
127
const prioritizeLink = ( url : string ) => {
127
128
const link = document . querySelector ( `link[href="${ url } "]` ) as HTMLLinkElement | null ;
128
129
if ( link ) {
129
130
link . fetchPriority = 'high' ;
130
- } else {
131
- console . warn ( `Preload link ${ url } not found` ) ;
132
131
}
133
132
} ;
134
133
Original file line number Diff line number Diff line change @@ -42,15 +42,6 @@ test.describe("container", () => {
42
42
const hash = await container . getAttribute ( "q:manifest-hash" ) ;
43
43
const bundleLink = page . locator ( `link#qwik-bg-${ hash } ` ) . first ( ) ;
44
44
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
55
46
} ) ;
56
47
} ) ;
You can’t perform that action at this time.
0 commit comments