Skip to content

Server Side Rendering #263

Description

@felixroos

Feature request summary

It would be good if swirl components supported Server Side Rendering (SSR), to reduce loading times.
As most of the components are static, it does not make a lot of sense to render them on the client when using SSR anyway.

Rationale

As of now, these components cannot be rendered on the server. (At least I haven't found a way to do that). This leads to huge JS bundles being shipped to the client. I made a little test to confirm that. Here is a screenshot of the Network tab when just using one SwirlButton:

image

If the SwirlButton is removed, the network tab looks like this:

image

If react is used without swirl on the client, it looks like this:

image

So above the ~100kB of react, swirl adds another ~150kB for components that are mostly static.

It seems to be possible to export Stencil components for SSR, see https://stenciljs.com/docs/hydrate-app

For static views, this could save ~250kB, which is quite significant on slower networks (>1s on 3g).
For dynamic views, it would still save ~150kB (>600ms on 3g).

edit: The above screenshots are from an astro build (SSR mode), but I also got similar results using Next.js earlier

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions