The AppRouterInstance.push doesn't do anything... (As far as I see)
Answered
Satin Angora posted this in #help-forum
Satin AngoraOP
I have this snippet
I'm getting logs as expected, but the
When I use
What may be the issue? (I do use
try {
const phoneAuthCreds = getCredentials(confirmationResult, submittedCode)
const userCreds = await signInWithCred(phoneAuthCreds)
console.log("signInWithCred has been called. userCreds is: "+userCreds.user.phoneNumber)
setSignedUser(userCreds.user)
} catch (e) {... which triggers this effect useEffect(() => {
if (signedUser !== null) {
console.log("There is a user! > " + signedUser.phoneNumber)
router.push("/dashboard")
router.refresh()
}
}, [router, signedUser]) I decided to use an effect, because the router.push wasn't working when I call it after completing sign-in neither.I'm getting logs as expected, but the
router.push(...) doesn't do anything! I get a loading action on the browser (small bar with the URL being loaded appears on the bottom left), but nothing happens. When not using router.refresh, after a while I get an Uncaught (in promise) Timeout error from the call to the Firebase, even though I get user data, so this maybe unrelated to the issue.When I use
router.refresh after the push call though, I get The resource http://localhost:3000/_next/static/css/app/[lang]/layout.css?v=1699562655947 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally I think I got a few different variations of this during testing.What may be the issue? (I do use
useRouter from next/navigation package)Answered by Satin Angora
The problem was related to my Middleware setup for protecting the dashboard page...
2 Replies
Satin AngoraOP
The problem was related to my Middleware setup for protecting the dashboard page...
Answer
Satin AngoraOP
Issue is related to Firebase, not Next 13.