next-routes icon indicating copy to clipboard operation
next-routes copied to clipboard

Wrong route and pathname

Open elvishp2006 opened this issue 6 years ago • 4 comments

I registered the following route:

routes.add({
  name: 'mensagens',
  pattern: '/mensagens',
  page: 'quotes',
});

When I check the router param on Router (imported from 'routes') object, I'm getting the follow params:

captura de tela de 2018-11-21 18-20-27

I'm acessing /mensagens but I'm getting /quotes as route and pathname

elvishp2006 avatar Nov 21 '18 20:11 elvishp2006

+1

edifier852 avatar Dec 13 '18 16:12 edifier852

Next.js Router needs to know these things because that is how it is routing internally. The asPath property is how the route appears, and the pathname and route properties are used to route to the correct component.

bigredwill avatar Jan 03 '19 19:01 bigredwill

/mensagens in this example should be accessible somehow too.

Pashozator avatar Feb 21 '20 09:02 Pashozator

Would is be possible to have a parameter with the path extracted from the query string? Currently, you could get /mensagens from asPath, but when you have a query string it will return that as well when you may only want the base route of /mensagens

santiagoramirez avatar Mar 25 '20 19:03 santiagoramirez