You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking at the server side rendering of a web page created via NextJS (app router). I am lazy and so just inline a SVG as an icon (twice). I see it duplicated yet again (so this is 4x the SVG now) in the script tag. In fact I see everything from the HTML in the script tag. It seems to be the same data as that which is in the RSC file. Why not just fetch that and let the static side be lean?
Note to self: using an SVG inline icon gets a huge write amplification (6x in this case -- two in HTML, two in HTML script tag, and two in RSC), and then 15000x of that. So instead of 1 copy, I have 90,000 copies of it.
Proposal
Don't inline in script that which can be loaded via RSC file.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
No response
Background
I was looking at the server side rendering of a web page created via NextJS (app router). I am lazy and so just inline a SVG as an icon (twice). I see it duplicated yet again (so this is 4x the SVG now) in the script tag. In fact I see everything from the HTML in the script tag. It seems to be the same data as that which is in the RSC file. Why not just fetch that and let the static side be lean?
Note to self: using an SVG inline icon gets a huge write amplification (6x in this case -- two in HTML, two in HTML script tag, and two in RSC), and then 15000x of that. So instead of 1 copy, I have 90,000 copies of it.
Proposal
Don't inline in script that which can be loaded via RSC file.
Beta Was this translation helpful? Give feedback.
All reactions