Skip to content

fix: remove the value of accessors too when migrating <svelte:options> - #19036

Open
wfatih wants to merge 1 commit into
sveltejs:mainfrom
wfatih:fix-migrate-accessors-value
Open

wfatih wants to merge 1 commit into
sveltejs:mainfrom
wfatih:fix-migrate-accessors-value

Conversation

@wfatih

@wfatih wfatih commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

migrate() removes accessors from <svelte:options> with a regex that only matches the attribute name. When the attribute has a value, the value is left behind and the output doesn't parse:

<svelte:options accessors={true} />

becomes

<svelte:options ={true} />

This change removes the attribute through its position in the parsed <svelte:options>, so the name and the value go together, along with the whitespace before it. The output for a bare accessors stays the same, as the existing accessors sample shows.

I found this by migrating every .svelte file in the test suites and compiling the result. hydration/samples/if-block-update uses accessors={true} and its migrated output didn't compile.

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.
    • tests/migrate/samples/accessors-with-value fails on main with the leftover ={true}.
  • 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
    • pnpm lint is clean. pnpm test: 7894 passed. The 3 failures are the timing-sensitive effect-loop-infinite and error-boundary-20 runtime tests. They fail the same way on main on my machine and pass when run alone.

@pkg-svelte-dev

Copy link
Copy Markdown

Install the latest version of svelte from 74196b2:

pnpm add https://pkg.svelte.dev/svelte/c/74196b2858199468705ea1adc0a78288a1e77635

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/svelte/pr/19036

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Oct 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 74196b2

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

This branch has not been deployed

No deployments
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.

1 participant