Skip to content

$inspect shows duplicate elements in arrays when using splice #15102

Open
@samausir

Description

@samausir

Describe the bug

I have an array let arr = $state(['a', 'b', 'c']). When I arr.splice(1, 1), $inspect(arr) first shows me ['a', 'c', 'c'] before showing the correct version, which is ['a', 'c'].

This was raised in #13494 before and was fixed, but it apparently has made a comeback.

Reproduction

https://svelte.dev/playground/0955025b01db4aa99efcd441351b33e9?version=5.19.2

Logs

init 
(3) [ "a" ,"b" ,"c" ]
update 
(3) [ "a" ,"c" ,"c" ]
update 
(2) [ "a" ,"c" ]

System Info

N/A

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions