question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Investigate delaying asPath values for all build-time exported pages

See original GitHub issue

When a page is exported at build time from either the automatic static optimization or from leveraging getStaticProps the asPath will initially be the pathname since it is the information we have for what the URL should be when visiting the page.

On the client we currently delay updating the asPath for dynamic pages that leverage the automatic static optimization to prevent a hydration mismatch. We should investigate applying this behavior for all build-time exported pages since they can all encounter a hydration mismatch if rewritten to using the rewrites feature and asPath is used while rendering the page.

Original issue opened here https://github.com/vercel/next.js/issues/17113 which was initially thought to be related to GS(S)P asPath resolving but is not since the reproduction provided only leverages pages that are automatically statically optimized without GS(S)P methods.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ijjkcommented, Nov 18, 2020

If asPath incorrect on the server-side this is bad news for SEO

@nghiepit this issue doesn’t address that, we can’t know the end asPath value for automatically statically optimized pages at build time unless you use getStaticProps with getStaticPaths

0reactions
nghiepdevcommented, Nov 18, 2020

Hi @ijjk

If asPath incorrect on the server-side this is bad news for SEO.

Some meta tags will be affected: og:url, rel:canonical , ... It will very difficult to calculate the URL correctly without the asPath.

<meta property="og:url" content="https://domain.com/my-post-1.html" />
Read more comments on GitHub >

github_iconTop Results From Across the Web

Modules • JavaScript for impatient programmers (ES2022 ...
Each module can have at most one default export. The idea is that the module is the default-exported value. Avoid mixing named exports...
Read more >
Next JS build failing due to ''Export encountered errors on ...
I fixed the following. all exported components in my pages folder should be like this: const Home = () => { return() }...
Read more >
gcc(1) - Linux manual page - man7.org
Possible values for language are: c c-header cpp-output c++ c++-header ... testing and investigation of compiler bugs and compile-time performance problems.
Read more >
List of Chromium Command Line Switches - Peter Beverloo
This page lists the available switches including their conditions and ... Note that the browser process has no /prefetch:# argument; as such all...
Read more >
OpenDJ 3 > Administration Guide - ForgeRock Backstage
Configure OpenDJ server connection handlers for all supported protocols ... To examine their values with the dsconfig command, use the --advanced option as ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found