Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
We need the ability to obtain data about the page in server components. Primarily for localization, but there are hundreds and thousands of cases where this is necessary. I understand the problems of creating context functions (and recently wrote my results on this here).
But we need a method. Here I propose another way (although I am still waiting for PR on getPathname, despite the fact that it feels great in my package). This is the same functionality that you use when generating pages. It covers a huge number of cases.
Please, look in this direction. This is a very, very serious problem for static applications.
I still do not know all the intricacies of next.js. Therefore, please, give an answer - what is wrong, where else to add this logic, where to write tests, what to consider and check!
Fixes #50405, #43704, #42301, #58862, #50575, etc.