-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix: increment and decrement edge case #11506
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: increment and decrement edge case #11506
Conversation
🦋 Changeset detectedLatest commit: 718ba19 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Rich-Harris
left a comment
There was a problem hiding this 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]); |
There was a problem hiding this comment.
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'| let to_mutate = value; | ||
| if (d === 1) { | ||
| to_mutate++; | ||
| } else { | ||
| to_mutate--; | ||
| } | ||
| set(signal, to_mutate); |
There was a problem hiding this comment.
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
|
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 😬 |
|
all good! just want to keep things tight. thanks! |
|
What's the reason for changing My apologies if this is not the right place to ask questions. I would like to learn so I can contribute as well. |
|
|
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-4and notmain.Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.Tests and linting
pnpm testand lint the project withpnpm lint