#How to set loader for SPA while loading other route?
12 messages · Page 1 of 1 (latest)
Something like nprogress (https://ricostacruz.com/nprogress/)?
I'm interested also 🙂
Yes! Something like nprogess
Have you tried location.isNavigating ?
not yet, I was hoping Qwik already have something out of the box.
So there is no easy way? I am trying to launch https://fugit.app but I got feedbacks like the website seems unresponsive sometimes, as on click on navigation we expect somethig to happen. But it takes a bit of time to load.
Ready for your next big adventure? Fugit is the app that helps you make it happen! Our AI-powered platform connects you with like-minded individuals who share your passion for exploring new places and trying new things. From hiking trails to hidden cafes, Fugit's personalized recommendations and social planning tools make it easy to create unfor...
What tzdesign described is built-in to qwik-city (and new to me 😉 ) but here's an example of a layout.tsx that would add a loading state while there's a pending navigation.
import { component$, Slot } from '@builder.io/qwik';
import { useLocation } from '@builder.io/qwik-city';
export default component$(() => {
const location = useLocation();
return (
<div class="page">
<main>
{location.isNavigating && (
<p
style={{ position: 'fixed', top: 0, left: 0, background: 'white' }}
>
Loading
</p>
)}
<Slot />
</main>
</div>
);
});
Full sample here: https://stackblitz.com/edit/qwik-starter-x5xj6k
Ahh! looks like a clean solution which I misunderstood
Sorry i didn’t unfold my knowledge completely 😄 thanks @eternal shoal
See the following integration of nprogress in qwik, by clicking over the flower, and the qwik logo. https://stackblitz.com/edit/qwik-starter-cdcb9v?file=src%2Fcomponents%2Fstarter%2Fheader%2Fheader.tsx
@wild light
I just created a simple component to add seamlessly nprogress into a qwik city app.
There you go !
https://www.npmjs.com/package/@quasarwork/qwik-city-nprogress
A simple Qwik City progress bar component using NProgress.. Latest version: 0.0.3, last published: 3 minutes ago. Start using @quasarwork/qwik-city-nprogress in your project by running npm i @quasarwork/qwik-city-nprogress. There are no other projects in the npm registry using @quasarwork/qwik-city-nprogress.