Skip to content

Svelte 5: TypeError: Cannot read properties of undefined (reading '__className') #13134

Closed
@ichbtrv

Description

@ichbtrv

Describe the bug

A class with an empty string causes the app to crash after more than one element is added.

Reproduction

https://gist.github.com/ichbtrv/0d1bd92446506babf6f6430f60f6c9bc

Steps:

  1. Comment out or delete the markup that is uncommented (lines 4 +5)
  2. Uncomment the p or the h1 on lines 1 or 2, displaying only one element
  3. Uncomment the remaining element from lines 1 or 2 to get the error.

Logs

Uncaught TypeError: Cannot read properties of undefined (reading '__className')

	in App.svelte

    at Module.set_class (chunk-ODCA3ZDS.js?v=3bd3c0ac:1588:29)
    at App (App.svelte?t=1725496964825:16:4)
    at chunk-ODCA3ZDS.js?v=3bd3c0ac:204:58
    at update_reaction (chunk-CDPR77WS.js?v=3bd3c0ac:1568:23)
    at update_effect (chunk-CDPR77WS.js?v=3bd3c0ac:1663:21)
    at create_effect (chunk-CDPR77WS.js?v=3bd3c0ac:991:7)
    at branch (chunk-CDPR77WS.js?v=3bd3c0ac:1120:10)
    at chunk-ODCA3ZDS.js?v=3bd3c0ac:198:17
    at update_reaction (chunk-CDPR77WS.js?v=3bd3c0ac:1568:23)
    at update_effect (:5173/node_modules/.vite/deps/chunk-CDPR77WS.js?v=3bd3c0ac:1663:21)TypeError: Cannot read properties of undefined (reading '__className')
    at Module.set_class (chunk-ODCA3ZDS.js?v=3bd3c0ac:1588:29)
    at App (App.svelte?t=1725496964825:16:4)
    at chunk-ODCA3ZDS.js?v=3bd3c0ac:204:58
    at update_reaction (chunk-CDPR77WS.js?v=3bd3c0ac:1568:23)
    at update_effect (chunk-CDPR77WS.js?v=3bd3c0ac:1663:21)
    at create_effect (chunk-CDPR77WS.js?v=3bd3c0ac:991:7)
    at branch (chunk-CDPR77WS.js?v=3bd3c0ac:1120:10)
    at chunk-ODCA3ZDS.js?v=3bd3c0ac:198:17
    at update_reaction (chunk-CDPR77WS.js?v=3bd3c0ac:1568:23)
    at update_effect (chunk-CDPR77WS.js?v=3bd3c0ac:1663:21)

System Info

System:
    OS: macOS 14.3
    CPU: (8) arm64 Apple M3
    Memory: 186.91 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    Yarn: 1.22.19 - ~/Library/pnpm/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 8.15.5 - ~/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 128.1.69.153
    Chrome: 128.0.6613.119
    Safari: 17.3
  npmPackages:
    svelte: ^5.0.0-next.1 => 5.0.0-next.243,
    @sveltejs/vite-plugin-svelte: ^4.0.0-next.6

Severity

blocking all usage of svelte

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions