Skip to content

Setting Object Reactivity Problem #14

Open
@Mootook

Description

It seems like object-nested values are not considered reactive. Wondering if this is a specific choice (if so, what're the suggested workarounds). Class properties work fine, but some of my classes have objects as properties which get set from null to some object structure after an api call. That final set does not seem to trigger a render update.

obj = null

const response = someAPI()

obj = response // does not trigger a rerender on dependent components

I've got a codesandbox to illustrate my point: https://codesandbox.io/s/vue-store-example-nested-key-reactivity-4v2s0?file=/src/components/HelloWorld.vue. From my understanding, Vue2 did have some reactivity caveats with objects. Wondering if those are to stay (my project is in vue3)

It's specifically related to add or deleting keys, as an object with the keys set already to dummy values seems to update.

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions