@@ -221,14 +221,8 @@ export function create_client({ target }) {
221
221
} ) ;
222
222
}
223
223
224
- /** @param {URL } url */
225
- async function preload_data ( url ) {
226
- const intent = get_navigation_intent ( url , false ) ;
227
-
228
- if ( ! intent ) {
229
- throw new Error ( `Attempted to preload a URL that does not belong to this app: ${ url } ` ) ;
230
- }
231
-
224
+ /** @param {import('./types').NavigationIntent } intent */
225
+ async function preload_data ( intent ) {
232
226
load_cache = {
233
227
id : intent . id ,
234
228
promise : load_route ( intent ) . then ( ( result ) => {
@@ -1261,7 +1255,8 @@ export function create_client({ target }) {
1261
1255
1262
1256
if ( ! options . reload ) {
1263
1257
if ( priority <= options . preload_data ) {
1264
- preload_data ( /** @type {URL } */ ( url ) ) ;
1258
+ const intent = get_navigation_intent ( /** @type {URL } */ ( url ) , false ) ;
1259
+ if ( intent ) preload_data ( intent ) ;
1265
1260
} else if ( priority <= options . preload_code ) {
1266
1261
preload_code ( get_url_path ( /** @type {URL } */ ( url ) ) ) ;
1267
1262
}
@@ -1347,7 +1342,13 @@ export function create_client({ target }) {
1347
1342
1348
1343
preload_data : async ( href ) => {
1349
1344
const url = new URL ( href , get_base_uri ( document ) ) ;
1350
- await preload_data ( url ) ;
1345
+ const intent = get_navigation_intent ( url , false ) ;
1346
+
1347
+ if ( ! intent ) {
1348
+ throw new Error ( `Attempted to preload a URL that does not belong to this app: ${ url } ` ) ;
1349
+ }
1350
+
1351
+ await preload_data ( intent ) ;
1351
1352
} ,
1352
1353
1353
1354
preload_code,
0 commit comments