@@ -221,14 +221,8 @@ export function create_client({ target }) {
221221 } ) ;
222222 }
223223
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 ) {
232226 load_cache = {
233227 id : intent . id ,
234228 promise : load_route ( intent ) . then ( ( result ) => {
@@ -1261,7 +1255,8 @@ export function create_client({ target }) {
12611255
12621256 if ( ! options . reload ) {
12631257 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 ) ;
12651260 } else if ( priority <= options . preload_code ) {
12661261 preload_code ( get_url_path ( /** @type {URL } */ ( url ) ) ) ;
12671262 }
@@ -1347,7 +1342,13 @@ export function create_client({ target }) {
13471342
13481343 preload_data : async ( href ) => {
13491344 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 ) ;
13511352 } ,
13521353
13531354 preload_code,
0 commit comments