Closed swarajbachu closed 9 months ago
Have you followed the guide for using LDRS with Next? https://github.com/GriffinJohnston/ldrs/blob/main/framework-guides.md#nextjs
I did try it and it was giving me hydration errors
How exactly have you used it in your project? I'll need to see some code to help troubleshoot.
I am actually using it as main loader, so I am using server side fetching, which sometimes makes loading new pages slower, to prevent that I am using loader
useEffect(() => {
const start = () => {
setLoading(true);
};
const end = () => {
setLoading(false);
};
Router.events.on('routeChangeStart', start);
Router.events.on('routeChangeComplete', end);
Router.events.on('routeChangeError', end);
return () => {
Router.events.off('routeChangeStart', start);
Router.events.off('routeChangeComplete', end);
Router.events.off('routeChangeError', end);
};
}, []);
{getLayout(loading ? <OwnLoader /> : <Component {...pageProps} />)}
function HourLoader() {
useEffect(() => {
async function getLoader() {
const { hourglass } = await import('ldrs');
hourglass.register();
}
void getLoader();
}, []);
return <l-hourglass color="black"/>;
}
function OwnLoader() {
return (
<div className="flex items-center justify-center h-screen">
<HourLoader />
</div>
);
}
I just spun up a quick demo app with create-next-app
using the pages router and it built and ran just fine, no errors. I think I'll need to know more about how your project is structured to troubleshoot this. Do you happen to have this project up on Github, or even better a minimal reproduction of the issue I can reference?
I'm closing this because I haven't heard back. Please feel free to submit a new issue with a reproduction somewhere if you're still having this problem!
I tried using both manual and auto and both doesnt seems to work on client side, in case we are using pages version of nextjs
I was using uiballs/loaders for my previous project and tried to find out it was replaced by good loaders but bad support