Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delay in loader display #22

Open
rohankm opened this issue Mar 12, 2024 · 5 comments
Open

delay in loader display #22

rohankm opened this issue Mar 12, 2024 · 5 comments

Comments

@rohankm
Copy link

rohankm commented Mar 12, 2024

hi im using router.push() from next/navigation. whenever I try to navigate the loader doesn't start on the go.. at the very end of the page load it starts showing.

@tomcru
Copy link
Owner

tomcru commented Mar 12, 2024

This is due to router.push() only firing at the end (when your page has loaded). I perceived the same behaviour when trying this out with nextjs. I'm not aware of any other events to listen to that trigger earlier. Do you have any suggestions?

@rohankm
Copy link
Author

rohankm commented Mar 12, 2024

Is it better to create a new router hook where we can manually track when the router.push is run

@monkeystylle
Copy link

hi is there an update or fix for this? the delay when using router.push ?

@tomcru
Copy link
Owner

tomcru commented May 3, 2024

I don't believe this is possible, because the router.push event only fires once the page has already loaded. Unless you are aware of another way we could implement this.

We did, however, just add 2 new funcs with which you can manually start & stop the loader:

'use client';

import { startHolyLoader, stopHolyLoader } from 'holy-loader';

startHolyLoader();
stopHolyLoader();

So you should be able to do:

startHolyLoader();
router.push('/your-page')

Make sure you are on the latest version (2.3.1) for these to be available. You can run npm upgrade holy-loader to update.

@monkeystylle
Copy link

hey thanks, after reading the docs, using startHolyLoader(); before router.push works.. thanks a lot

hootanht added a commit to hootanht/holy-loader that referenced this issue Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants