Skip to content

Conversation

@paoloricciuti
Copy link
Member

Svelte 5 rewrite

Closes #11501

Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (main).

If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is svelte-4 and not main.

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 and linting

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

@changeset-bot
Copy link

changeset-bot bot commented May 7, 2024

🦋 Changeset detected

Latest commit: 718ba19

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

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks — gonna make a few changes

await Promise.resolve();
assert.equal(decrement_before?.innerHTML.trim(), '-1');

assert.deepEqual(logs, ['0', 1, '0', -1]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty sure this is wrong:

let x = '0';
typeof x++; // 'number'

Comment on lines 1015 to 1021
let to_mutate = value;
if (d === 1) {
to_mutate++;
} else {
to_mutate--;
}
set(signal, to_mutate);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be simplified a lot, we just need to coerce the original value

@sveltejs sveltejs deleted a comment from Nungzakpp May 7, 2024
@sveltejs sveltejs deleted a comment from Nungzakpp May 7, 2024
@paoloricciuti
Copy link
Member Author

Uh I went that route just to avoid every possible edge case but I guess this is probably the sole edge case anyway.

Sorry for the mess 😬

@Rich-Harris Rich-Harris merged commit 0cf6d56 into sveltejs:main May 7, 2024
@Rich-Harris
Copy link
Member

all good! just want to keep things tight. thanks!

@SaintPepsi
Copy link

What's the reason for changing let to var in packages /svelte/src/internal/client/ runtime.js on line 1025?

My apologies if this is not the right place to ask questions. I would like to learn so I can contribute as well.

@Rich-Harris
Copy link
Member

var is faster, because there's no need to check for temporal dead zone violations

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.

Svelte 5: Increment(++) and Decrement(--) operator output is incorrect

3 participants