Skip to content

v-with not updating objects set via this.$set (breaking change from 0.11.5 to 0.11.6) #802

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

Closed
cheapsteak opened this issue Apr 21, 2015 · 8 comments

Comments

@cheapsteak
Copy link
Contributor

Hi there,

Don't have the problem isolated into a fiddle yet, but just a heads up that a use case for watching objects seems to have broken from 0.11.5 to 0.11.6 (We noticed this when a developer on my team got a new computer and was using the same code as us but the app wasn't working, noticed the difference in Vue versions, downgraded back to 0.11.5 everything was good)

Component Alpha watches its own property 'foo', which is passed in to it via v-with from the parent component Beta.

In the template, <div v-component="alpha" v-with="foo: parentFoo"> (not sure if this matters, but the component alpha is also in a v-repeat)

Beta sets parentFoo in its compiled hook via this.$set('parentFoo', {key1: val1, key2: val2})

In 0.11.6, the child component (alpha)'s foo will be undefined

Fiddle incoming (either lunch of after work)

@cheapsteak cheapsteak changed the title breaking change from 0.11.5 to 0.11.6 v-with not passing objects set via this.$set (breaking change from 0.11.5 to 0.11.6) Apr 21, 2015
@cheapsteak cheapsteak changed the title v-with not passing objects set via this.$set (breaking change from 0.11.5 to 0.11.6) v-with not updating objects set via this.$set (breaking change from 0.11.5 to 0.11.6) Apr 21, 2015
@salazr
Copy link

salazr commented Apr 21, 2015

Same problem here. One of our developers ran into it this morning.

In our app, removing v-with allowed us to get the app running again. Luckily we're just a couple of weeks of development in so there is not a lot that breaks by changing this.

@yyx990803 yyx990803 reopened this Apr 21, 2015
@yyx990803
Copy link
Member

Pushed a fix to dev branch. Please try it and see if it fixes the issue - and do let me know if there are other breaks after the upgrade! Thanks for reporting the issues.

@cheapsteak
Copy link
Contributor Author

Sorry, I'm failing google or google's failing me,
How can I do an npm install from the dev branch?

@yyx990803
Copy link
Member

npm install yyx990803/vue#dev

@cheapsteak
Copy link
Contributor Author

That didn't seem to do the trick ("version": "0.11.7", "_from": "git://github.com/yyx990803/vue#dev")
I'll put together a fiddle when I get home :)

@cheapsteak
Copy link
Contributor Author

Unfortunately still seems broken in 0.11.8 :(
I'll work on fiddle now

@cheapsteak
Copy link
Contributor Author

working in 0.11.5:
http://jsfiddle.net/5sH6A/98/

broken in 0.11.6 through 0.11.8
http://jsfiddle.net/Le3sdytu/4/

edit/update:
stubbing out an undefined data property seems to make things work again

data: {
    items: [{},{},{},{},{},{}],
    parentObject: undefined // <--- added this
},

http://jsfiddle.net/3n8rw8en/

I'd say this wouldn't be too big a deal, although perhaps consider either

  • a warning when using this.$set to set a property that hasn't been stubbed out and therefore would not update anything that previousy tried to bind to it
  • a warning when trying to pass something to be bound in v-with when the property does not exist.

@yyx990803 yyx990803 reopened this Apr 22, 2015
@yyx990803
Copy link
Member

Turns out it was a small optimization attempt that wasn't carefully thought through: yyx990803/vue@5824751#diff-c052e1f68cd9ca32c302763fb617e335R123

It's now fixed for real in dev branch.

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

3 participants