Skip to content

Conversation

@trueadm
Copy link
Contributor

@trueadm trueadm commented Dec 16, 2024

Closes #14705.

@changeset-bot
Copy link

changeset-bot bot commented Dec 16, 2024

🦋 Changeset detected

Latest commit: 45875e9

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

@github-actions
Copy link
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@14729

const index = indexOf.call(this, item, from_index);

if (index === -1) {
if (index === -1 && is_object(item)) {
Copy link
Member

Choose a reason for hiding this comment

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

What I don't quite understand is why the proxied version would give a different result - is it not updated yet to the latest value?

Copy link
Contributor Author

@trueadm trueadm Dec 16, 2024

Choose a reason for hiding this comment

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

We don't modify the original object on mutations to the proxied object, so here the proxied version is [] and the original object is [1], so it triggers the warning because it first checks if the proxied array has it, then checks if the original array has it.

@Rich-Harris
Copy link
Member

This doesn't seem right at all. The issue is that we're comparing the proxied array with its target, when we should be comparing the proxied items with their targets. Notice how in this repro the warnings still occur after you've cleared the array.

Opened #14738

@trueadm trueadm closed this Dec 17, 2024
@trueadm trueadm deleted the fix-warning branch December 17, 2024 17:21
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.

Warning: state_proxy_equality_mismatch when checking Array.prototype.includes after emptying the array

4 participants