Next.js Discord

Discord Forum

Needs opinion regarding userid param vs username param

Unanswered
Mnigos posted this in #help-forum
Open in Discord
I have a questions regarding nextjs generateStaticParams. I used id as param and recently I changed that to username which also will be unique. But I wanted to implement ability to change username. Do you think it's good idea to use username instead of id? If user changes his username is there possibility that something breaks?

1 Reply

@Mnigos I have a questions regarding nextjs generateStaticParams. I used id as param and recently I changed that to username which also will be unique. But I wanted to implement ability to change username. Do you think it's good idea to use username instead of id? If user changes his username is there possibility that something breaks?
Yes I strongly advise against using username and instead using userID for that exact reason.

Any links to the users old username unless specifically redirected will result in a 404, using the userId will prevent this from happening.