Skip to content

Throw error/warn if watch path doesn't resolve to an existing property #11113

Open
@WofWca

Description

@WofWca

What problem does this feature solve?

Currently, if a watch path does not address an existing property, its handler would just silently never execute.
This may cause bugs due to a typo or refactoring that involves restructuring the app model. Especially if we want to watch something like '$store.state.user.user.subscriptions'.

Here's a JSFiddle to play with: https://jsfiddle.net/WofWca/50feyxn7

What does the proposed API look like?

Just throw an error (or warn?) in such case. Like it would happen if we used this.$watch(() => this.$store.state.user.user.subscriptions, () => { .... });

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