Skip to content

Object.create breaks reactivity #16123

Closed
@jzjones

Description

@jzjones

Describe the bug

If you use anything created by Object.create as $state, you will seemingly lose reactivity.

It's trivial to work around in most cases by deep cloning, etc, however I don't see anything that indicates this should be a problem in the first place. This could make it difficult to diagnose why your app is losing reactivity especially when libraries such as https://github.com/bufbuild/protobuf-es use Object.create internally and seem to return ordinary objects.

Reproduction

https://svelte.dev/playground/hello-world?version=5.33.18#H4sIAAAAAAAAA4WTTW_CMAyG_0oWcWglVATH0lXabdoBDhzXHUJrIFtIqsSFoSr_fQn9AlZtl8Z-bSeP46amkh2BxvQVhFDkrLQoSAAFRyhCOqU7LsDQ-L2meCl9nhec3la9lGVkTiDQa1tmYEzPlUSQ6Lahick1LzHNZIZONkhKrVCRZ1J7qTKg48bMEFWhTEw6txHm8eBneGKigphk9DDQZ7SL28a4Lu7jV2cJQIJgcIMMwR08Md4I1ttPyDFixvC9DJrKVss1-IwraThtQj3EHfIN9o0yRn5H7_YX5OpldHqbYwfHjnUVhsuRphZDV-2JD5C_EccAezyFB9Ad3z9EtiPaVTJHriTJD0zuIQj7sXaYkaeKrix-_nb5EF-MJrRTnHBpSjecoE_3Byez4f-SyWGe3k3Q9fe2Wa8ig5rLPd9dgjGW0D4lM1fabLBS-sjEH5WLu9Kuclu5K5VEyVzw_Ou5bi7Bpr4smTXR1D0NhG-kMeoK7IfzGBdnLgsa75gwYH8A5RhHJZ0DAAA=

Logs

System Info

REPL

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions