inertiajs / inertia-laravel

The Laravel adapter for Inertia.js.
https://inertiajs.com
MIT License
2.01k stars 224 forks source link

Progress bar not working on route navigation #577

Open davadams97 opened 7 months ago

davadams97 commented 7 months ago

I am trying to display a progress bar for one my pages. According to the docs, I can use router.on('start') and pass in nProgress.start() as a callback.

However, that does not seem to work. I have tried with other router states like navigate (which works).

I have declared this in my vue component as such. I am preserving logs too ensure nothing is missed, but that log never gets printed.

router.on("start", () => {
    nProgress.start();
    console.log('started')
});

I would appreciate any help on this matter. Please let me know if you need more context.

craigrileyuk commented 5 months ago

Think is a question for inertiajs/inertia rather than inertiajs/inertia-laravel (the backend bridge for Laravel).

But as of inertia (frontend) v1.0.0, nProgress is loaded by default. You can configure it by passing a progress object to the Inertia app config:

createInertiaApp({
  progress: {
    delay = 250,
    color = '#29d',
    includeCSS = true,
    showSpinner = false,
  },
  // other options
})

Note the 'delay' prop which is the time a navigation request must take before a loading indicator is shown.