keyword: displaying loading spinner
Imagine accessing a route like /dashboard
, where most of the page content remains constant but certain sub-components require real-time data. If I retrieve this data within a load
function, the entire route will remain blank until the data is fetched.
Another approach would be to fetch data during onMount
or utilizing {#await}
, which allows for the inclusion of a loading spinner to enhance user experience. (In cases where server-side fetching is necessary, an API route can be used)
This leads to the question - when is it appropriate to use the load
method? Is it primarily for clients with slow internet connections, JavaScript disabled clients, or for SEO purposes?