Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show asPath on large page data warning #39071

Merged
merged 4 commits into from Jul 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/next/pages/_document.tsx
Expand Up @@ -978,7 +978,11 @@ export class NextScript extends Component<OriginProps> {

if (largePageDataBytes && bytes > largePageDataBytes) {
console.warn(
`Warning: data for page "${__NEXT_DATA__.page}" is ${prettyBytes(
`Warning: data for page "${__NEXT_DATA__.page}"${
__NEXT_DATA__.page === context.dangerousAsPath
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason this is called dangerousAsPath?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we named it this to stress it wasn't normalized/sanitized although it was mainly added for rendering the canonical meta tag for AMP.

? ''
: ` (path "${context.dangerousAsPath}")`
} is ${prettyBytes(
bytes
)} which exceeds the threshold of ${prettyBytes(
largePageDataBytes
Expand Down