-
-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
🐛 Issue: next-intl conflicts with nextjs-toploader due to custom useRouter
❓ Question
How can I use both next-intl (with i18n routing) and nextjs-toploader in a Next.js App Router project, when both libraries rely on useRouter() and seem to conflict?
📦 Context
- I'm using Next.js 15 App Router with
next-intlconfigured for i18n routing (/en/...,/vi/...) using the[locale]/segment andmiddleware.ts. - I want to display a top loading progress bar on route change using
nextjs-toploader. - However, once
next-intlwraps or patches therouterinternally,nextjs-toploaderno longer works properly — the loading bar doesn't show.
💥 What I’ve tried
- Placing
<NextTopLoader />insideapp/[locale]/layout.tsx. - Disabling spinner, customizing color and height.
- Avoiding multiple calls to
useRouter()in the same component. - Using
without i18n routingmode (works, but I need localized URLs like/vi/...).
❗Expected Behavior
When using locale-prefixed routes (/vi/..., /en/...), I should still be able to use nextjs-toploader to indicate navigation progress during route changes.
✅ Ideal Solution
- An official recommendation on how to make both libraries work together without conflict.
- Or a workaround to trigger route-change loading manually (e.g. a hook or public API).
Metadata
Metadata
Assignees
Labels
No labels