Skip to content

Conversation

benmccann
Copy link
Member

@benmccann benmccann commented Jan 14, 2024

A huge portion of SvelteKit apps in the wild that are failing core web vitals are single page apps. The percentage of SvelteKit apps which pass/fail are tracked on cwvtech.report leveraging data from HTTP Archive. Some folks at Google were able to supply me with a random sample of SvelteKit sites from this dataset. While investigating the failing sites, I saw that the most common cause of failure was extra round trips due to deployment as a SPA.

Copy link

changeset-bot bot commented Jan 14, 2024

⚠️ No Changeset found

Latest commit: 8af8994

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@eltigerchino eltigerchino added the documentation Improvements or additions to documentation label Jan 15, 2024
Co-authored-by: Willow (GHOST) <ghostdevbusiness@gmail.com>
@benmccann benmccann changed the title docs: clarify that fallback page is generated docs: clarify the harms of single page app (SPA) mode Jan 15, 2024
@benmccann benmccann changed the title docs: clarify the harms of single page app (SPA) mode docs: further clarify and reinfornce the harms of single page app (SPA) mode Jan 15, 2024
@benmccann benmccann changed the title docs: further clarify and reinfornce the harms of single page app (SPA) mode docs: further clarify and reinforce the harms of single page app (SPA) mode Jan 15, 2024
@benmccann benmccann changed the title docs: further clarify and reinforce the harms of single page app (SPA) mode docs: further clarify and reinforce the harms of single page apps (SPAs) Jan 15, 2024
Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

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

I gotta push back on the language of these changes and some of these changes in general - it sounds like we're on a crusade against SPA mode now. This creates FUD ("omg SPA mode always bad", which isn't true because it depends on your site) and may turn people off from using SvelteKit ("ok so they hate SPA I'll look for another framework that supports it better") which helps neither web vitals nor us.

I think there are other avenues to explore:

  • some kind of SvelteKit dev tools which somehow analyzes your page and gives you some tips what you can improve, where this plays a part
  • partial prerendering which will improve perceived performance and probably web vitals
  • understanding why people opt for SPA mode in the first place and solve the roadblocks towards leaving SSR enabled

@@ -46,6 +46,6 @@ In SvelteKit, you can do static site generation by using [`adapter-static`](adap

## SSR

Server-side rendering (SSR) is the generation of the page contents on the server. SSR is generally preferred for SEO. While some search engines can index content that is dynamically generated on the client-side it may take longer even in these cases. It also tends to improve perceived performance and makes your app accessible to users if JavaScript fails or is disabled (which happens [more often than you probably think](https://kryogenix.org/code/browser/everyonehasjs.html)).
Server-side rendering (SSR) is the generation of the page contents on the server. Returning the page contents from the server via SSR (including with prerendering) is highly preferred for performance and SEO. It drastically improves performance by avoiding the introduction of an extra round trip necessary in a SPA and makes your app accessible to users if JavaScript fails or is disabled (which happens [more often than you probably think](https://kryogenix.org/code/browser/everyonehasjs.html)). While some search engines can index content that is dynamically generated on the client-side it is likely to take longer even in these cases.
Copy link
Member

Choose a reason for hiding this comment

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

This isn't really true - it's more about the perceived performance. The HTML is already there, but you still have the second roundtrip of fetching the JS which hydrates your stuff and then it's interactive. If your page doesn't work without JS it might feel just as bad.

Copy link
Member

Choose a reason for hiding this comment

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

'roundtrip' refers to the data that is inlined into the page (whether in the form of serialised server data or inlined event.fetch responses)

Copy link
Member Author

Choose a reason for hiding this comment

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

And if your site is content to be read, it's much more than perceived performance - it's actual performance

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
@svelte-docs-bot
Copy link

benmccann and others added 7 commits February 9, 2025 19:00
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
@Rich-Harris Rich-Harris merged commit 359caf7 into main Aug 19, 2025
21 checks passed
@Rich-Harris Rich-Harris deleted the fallback-docs branch August 19, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants