-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Add logo option #6817
Add logo option #6817
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size changes📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
Page | Size (compressed) |
---|---|
global |
104.12 KB (🟡 +38 B) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Five Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
Page | Size (compressed) | First Load |
---|---|---|
/404 |
80.46 KB (🟡 +158 B) |
184.58 KB |
/500 |
80.46 KB (🟡 +158 B) |
184.58 KB |
/[[...markdownPath]] |
82.28 KB (🟡 +158 B) |
186.4 KB |
/errors |
80.67 KB (🟡 +158 B) |
184.79 KB |
/errors/[errorCode] |
80.65 KB (🟡 +158 B) |
184.77 KB |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link
is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.
@@ -19,6 +19,41 @@ const MyDocument = () => { | |||
}} | |||
/> | |||
<body className="font-text font-medium antialiased text-lg bg-wash dark:bg-wash-dark text-secondary dark:text-secondary-dark leading-base"> | |||
<script | |||
dangerouslySetInnerHTML={{ | |||
__html: ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a __html
object inline like this is explicitly discouraged in the React docs 😅 we should follow the best practices here.
Can't the script just go in a regular .js file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no other way to use dangerouslySetInnerHTML
, which we have to use since the head rendered by React and browsers ignore script text set by innerText for security reasons.
The cautions about it being unsafe are not applicable, because the string is static. We can't use a .js
file because it would require a round trip to fetch the script, so it would run later and flash the wrong theme or logo (see the existing logic for setting the theme in the script tag below this).
When we convert to the App Router, this is supported out of the box with React 19 with the new Resources support https://react.dev/reference/react-dom/components#resource-and-metadata-components
Overview
Adds a query param to switch the React logo to https://github.com/SAWARATSUKI/ServiceLogos:
?uwu=true
?uwu=false
Setting will persist until you turn it off.
Screen
Credits
Credit to @SAWARATSUKI in https://github.com/SAWARATSUKI/ServiceLogos
This PR also adds a console.log and footer credit for the amazing artwork.