Skip to content

SSR does not match CSR HTML when {#each} block next to inline elements. (Extra spaces inserted.) #8320

@Leftium

Description

@Leftium

Describe the bug

Server-side-rendered HTML does not match client-side-rendered HTML when an {#each} block is next to inline elements. (Extra spaces inserted.) This causes the layout to "jump."

It seems to matter if there are inline elements before and/or after the {#each} block.

Reproduction

  1. Go to https://kit-demos-git-ssr-csr-bug-leftium.vercel.app/.
  2. Observe button layout.

Expected: Button layout doesn't shift and is consistent between cases.

Actual: Button layout shifts and spacing is inconsistent between cases. (Specifically case A vs case D)

Source: https://github.com/Leftium/kit-demos/tree/ssr-csr-bug


Real-world example of bug: https://multi-launch-lusvcmx44-leftium.vercel.app/
Source: https://github.com/Leftium/multi-launch/tree/7017891858fcb8f8a495a4a4dbc208f83402c7be

Logs

No response

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 8.38 GB / 23.86 GB
  Binaries:
    Node: 18.9.0 - D:\dropbox\a\nodejs\64v18.9.0\node.EXE
    Yarn: 1.22.18 - D:\dropbox\home\.yarn\bin\yarn.CMD
  Browsers:
    Edge: Spartan (44.22621.1105.0), Chromium (110.0.1587.50)
    Internet Explorer: 11.0.22621.1

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions