Skip to content

Svelte 5: Array<{ name: string }>, array.reverse() causes $inspect to run array.length times #9831

@PuruVJ

Description

@PuruVJ

Describe the bug

If an array of objects(files) is declared with $state is reversed, $inspect(files) should give only one log, but it logs arra.length number of times(if 4 items in array, 4 update logs). Does that mean that all the individual objects are also being updated? If so, that's breaking fine-grained reactivity.

ASIDE: Is it supposed to log Proxy object to the console? I assumed it would unwrap it all and give the nice and original object array. Not a breaker for me, just a opinion.

CleanShot 2023-12-07 at 14 39 03@2x

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE3VRwWrCQBD9lWErGEESW0oPqQql9Ki92JP2EOPEbEmyYWdikWX_vbOJCC32tDPvvXm8nXGq0BWSSrdONVmNKlUvbaumis9taOiEFaP0ZDqbB2ROudUtL3fNjpMEPtav76vV23oDXCJUGTE8gGasCdgAIfZ409V7tGAK6NpDxiI0R7o4iOxooLCmhsfQPAW8QoY-GSxgRCwj0TbgO3YQcqYwlpzxEG8MfvqHjLE53YAzmfmif4jB7Bcv8a6SUgtlmtvkd3nm0sQ5XYc_J8_ySDHSDbWYc9T_ZzKAhLzRNZqOo2gCiyW4wbPXxBZPaAmjIGY_hfvZbCb1PLnsHoKJu8MsLy9byqgvfBhwoYpDMA_zvU3kVC4JWi93rM1BFxoPKmXbof_0P_qv3QwCAgAA

Logs

No response

System Info

svelte 5 repl

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions