next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Feature request: need `params` field in route

Open smoonsf opened this issue 7 years ago • 2 comments

Feature request

Is your feature request related to a problem? Please describe.

We need params field in route data to distinguish which is for pathname and search string.

for example of route rule /project/[project_id], url /project/3, url /project?project_id=3, /project/3?project_id=3 makes same parsed query field in route data.

Describe the solution you'd like

Add params field in route object.

for example of route rule /project/[project_id],

url /project/3 => { query: {}, params: { project_id: '3' } } url /project?project_id=3 => { query: { project_id: '3' }, params: {} } url /project/3?project_id=3 => { query: { project_id: '3' }, params: { project_id: '3' } }

Additional context

Generally, query string is optional for deciding page route but params(that make up pathname ex. post_id, etc) are necessary, especially in file-base routing system like nextjs. So I think it should be handled separately.

smoonsf avatar Oct 31 '19 08:10 smoonsf

The routing is merged in query on purpose as a proxy could handle the pattern matching eg for the serverless target. We're not planning to change this currently.

timneutkens avatar Oct 31 '19 11:10 timneutkens

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

balazsorban44 avatar Jan 31 '22 00:01 balazsorban44