router redirection not working??
Unanswered
Polar bear posted this in #help-forum
Polar bearOP
Hello !
My router dosnt redirect to /board/${data.id} as intended on my form-popover file. It should show me a 404page cause i didnt created the page for now witch is normal. Ive tried alot of things to debug but i could not find the solution for several days now. I tried console logging the link, and when its pasted it shows that404 page . I also tried downgrading the version of next but dosnt changed. I am realy lost there.
my repo : https://github.com/SHOOTSTV/trello-clone
my prisma schema aswel :
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
relationMode = "prisma"
}
model Board {
id String @id @default(uuid())
orgId String
title String
imageId String
imageThumbUrl String @db.Text
imageFullUrl String @db.Text
imageUserName String @db.Text
imageLinkHtml String @db.Text
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
My router dosnt redirect to /board/${data.id} as intended on my form-popover file. It should show me a 404page cause i didnt created the page for now witch is normal. Ive tried alot of things to debug but i could not find the solution for several days now. I tried console logging the link, and when its pasted it shows that404 page . I also tried downgrading the version of next but dosnt changed. I am realy lost there.
my repo : https://github.com/SHOOTSTV/trello-clone
my prisma schema aswel :
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
relationMode = "prisma"
}
model Board {
id String @id @default(uuid())
orgId String
title String
imageId String
imageThumbUrl String @db.Text
imageFullUrl String @db.Text
imageUserName String @db.Text
imageLinkHtml String @db.Text
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
59 Replies
@Alfonsus Ardani where is your form popover file?
Polar bearOP
here
. /components/form/form-popover.tsx
@Alfonsus Ardani i checked everywhere
Polar bearOP
As of now yes because on the tutorial im watching it is supposed to redirect to 404 page and thΓ© when I create it it does work
okayy um so what doesn't work?
Polar bearOP
I didnt pushed the version that I did created the route but it does nothing at all
Even if I created it
@Alfonsus Ardani okayy um so what doesn't work?
Polar bearOP
It looks like it dosnt even redirect to 404 page
Like its Frozen or something
can you send like the latest code..
Polar bearOP
Yes I will do it soon as im back home π, thank you for your Time
I see, safe driving. It would be nice next time if you can send a proper context if you want to ask help π
Polar bearOP
Yes I understand. I am sort of new to coding so I dont have the proper wording sometimes
Sorry for that, i struggle to write What the problem actualy is
I see, then we will look at it together and which part doesn't work
Polar bearOP
π thanks alot
@Polar bear It looks like it dosnt even redirect to 404 page
Dwarf Hotot
for this to happen you have to create a notfound page also then only it will show 404 page not found
there is no app/not-found.tsx page is created, thats why 404 or page not found is coming , first you have to create this file then this file will handle all the routes which are not present and show 404 or any thing which you erite in this file
try this
router.refresh()
router.push(`/board/${data.id}`);
@gin try this
typescript
router.refresh()
router.push(`/board/${data.id}`);
Polar bearOP
just tried and not working :/
@Polar bear just tried and not working :/
u put it in your onSuccess callback correct?
cause i had same issues in the past and this always fixed it for me
Dwarf Hotot
You need to create not-found.tsx file in app folder
@Alfonsus Ardani I see, then we will look at it together and which part doesn't work
Polar bearOP
https://github.com/SHOOTSTV/trello-clone just pushed the code with the board route and page π
(still no redirection)
@Dwarf Hotot for this to happen you have to create a notfound page also then only it will show 404 page not found
Polar bearOP
Oh didnt know that, on the tutorial it dosn't look like he created one, it was the default next 404 pageπ€
@gin u put it in your onSuccess callback correct?
Polar bearOP
like this? i tried and it didnt worked
no redirection?
Polar bearOP
no :/
and your toast triggers?
and whatever that is closes?
Polar bearOP
thats weird cause when i hover the board i can see this on the bottom left corner
but clicking dosnt do anything
@gin and your toast triggers?
Polar bearOP
the toaster is working yes
Polar bearOP
More context
looks like it auto redirects me on the last page
we can see the url changing from the good one (board/*) to the original org/** page
@Dwarf Hotot You need to create not-found.tsx file in app folder
Polar bearOP
i created the route instead and still not working :/
@Polar bear More context
did you already have file on
board/
?Polar bearOP
Yes I created one
try removing middleware.ts
and redirecting again
Polar bearOP
i just did, it looks like i can access the board page whitout getting rollback like the video I sent
but i dont know if its just because the auth is now broken due to the middleware deletion and i can't go into the org page
@Polar bear but i dont know if its just because the auth is now broken due to the middleware deletion and i can't go into the org page
it seems like theres something wrong with the middleware logic
Polar bearOP
I see
that's strange because I was following a tutorial, maybe alot changed between my et his next versions?
because for example he's using authMiddleware which is deprecated and is now clerkMiddleware
Polar bearOP
Welp update : one good one bad news, the good one is that my problem is now fixed! the bad one is that I just downgraded clerk version so i don't know what were the problem π