Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to prevent setting invalid paths? #13

Open
chipit24 opened this issue Jun 24, 2019 · 0 comments
Open

How to prevent setting invalid paths? #13

chipit24 opened this issue Jun 24, 2019 · 0 comments

Comments

@chipit24
Copy link

chipit24 commented Jun 24, 2019

The following code works fine:

this.$vueSet({}, 'foo.0.bar'); // { "foo": [{ "bar": "some value" }] }
this.$vueSet({}, 'foo.000'); // { "foo": ["some value"] }

However, the following code produces an error:

this.$vueSet({}, 'foo.000.bar'); // error TypeError: Cannot use 'in' operator to search for 'bar' in undefined

If I wrap it in a try/catch block, Vue still complains:


[Vue warn]: Cannot set reactive property on undefined, null, or primitive value: undefined

Is there some strategy for validating object paths? Considering foo.000 works, I also expect foo.000.bar to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant