File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
packages/kit/src/runtime/client Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @sveltejs/kit ' : patch
3+ ---
4+
5+ fix: warn after failed data preloads in dev
Original file line number Diff line number Diff line change @@ -1256,7 +1256,22 @@ export function create_client({ target }) {
12561256 if ( ! options . reload ) {
12571257 if ( priority <= options . preload_data ) {
12581258 const intent = get_navigation_intent ( /** @type {URL } */ ( url ) , false ) ;
1259- if ( intent ) preload_data ( intent ) ;
1259+ if ( intent ) {
1260+ if ( __SVELTEKIT_DEV__ ) {
1261+ preload_data ( intent ) . then ( ( result ) => {
1262+ if ( result . type === 'loaded' && result . state . error ) {
1263+ console . warn (
1264+ `Preloading data for ${ intent . url . pathname } failed with the following error: ${ result . state . error . message } \n` +
1265+ 'If this error is transient, you can ignore it. Otherwise, consider disabling preloading for this route. ' +
1266+ 'This route was preloaded due to a data-sveltekit-preload-data attribute. ' +
1267+ 'See https://kit.svelte.dev/docs/link-options for more info'
1268+ ) ;
1269+ }
1270+ } ) ;
1271+ } else {
1272+ preload_data ( intent ) ;
1273+ }
1274+ }
12601275 } else if ( priority <= options . preload_code ) {
12611276 preload_code ( get_url_path ( /** @type {URL } */ ( url ) ) ) ;
12621277 }
You can’t perform that action at this time.
0 commit comments