Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ichbtrv opened this issue Sep 5, 2024 · 1 comment

Comments

@ichbtrv
Copy link

ichbtrv commented Sep 5, 2024

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

@ichbtrv ichbtrv changed the title TypeError: Cannot read properties of undefined (reading '__className') (Svelte 5) [Svelte 5] TypeError: Cannot read properties of undefined (reading '__className') Sep 5, 2024
@ichbtrv ichbtrv changed the title [Svelte 5] TypeError: Cannot read properties of undefined (reading '__className') Svelte 5: TypeError: Cannot read properties of undefined (reading '__className') Sep 5, 2024
@paoloricciuti
Copy link
Member

This was already fixed by #13113 and would still be a duplicate of #13111 .

Here's a working repl

We will publish the fix in the next release. Thanks for reporting anyway 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants