Skip to content
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

fix: Add more checks to determine if element is non-static #15259

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ranjan-purbey
Copy link

@ranjan-purbey ranjan-purbey commented Feb 11, 2025

Fixes #15241

The visitor for RegularElement expects a node_id for the current element in certain cases. However we skip generating one when the element is "static". This causes an error during hydration if the element was incorrectly marked static but the visitor still expects a node_id. See this comment for example cases.

Ideally, the ComponentClientTransformState should have a getNode() method instead of a node property. That would let us bypass the need for checking if the element is static and lazily generate an identifier.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Copy link

changeset-bot bot commented Feb 11, 2025

🦋 Changeset detected

Latest commit: 89410dc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

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

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

Successfully merging this pull request may close these issues.

hasAttribute is not a function
1 participant