Vue: List of breaking changes in 1.0.18

Created on 20 Mar 2016  路  16Comments  路  Source: vuejs/vue

Vue.js version

1.0.18

"Bug"

I am the maintainer of vue-google-maps and I saw multiple breaking changes in vue 1.0.18.

I was able to identify one : "If you have a data function that returns undefined then vue is absolutely broken", I know it can't be considered as a bug, but still it's not mentioned in the release report.

But I still have problems and can't update my library to work with vue 1.0.18. Could you make a list of all breaking changes so I can fix them ?

Thank you very much

Most helpful comment

Everything is fixed in vue-google-maps

All 16 comments

Hmm, there's no breaking change in the public API, but there was some refactoring regarding props initialization. It'd be helpful to see what error you are actually getting.

https://github.com/GuillaumeLeclerc/vue-google-maps/commit/0a3a74b5fdd2f4dd3132c0cf4a2315c726b55b56

fixed one of them. But I'm still running into problems. I have an undefined prop in some component.

Thank you for your help

FYI If you want to attach properties you should do it in created instead of data.

I need more information on your other problems - in particular the error stack.

The stack trace does not have anything to do with vue. I just get an undefined property. then this undefined is passed to the google API and it triggers an error.

I will ping when I have more information. I just can't afford spending more time on this today sorry

Repro: http://www.webpackbin.com/E16Afk_ae

@GuillaumeLeclerc looks like some of your data functions do not return, or return null.
Here is a demo that shows the exact same issue: https://jsfiddle.net/simplesmiler/s4pmknwu/

@yyx990803 worth adding a check on the Vue side? Warn user that they provided a data function, but did not return an object?

From the Docs:

When defining a component, data must be declared as a function that returns the initial data object

Looks like you're making the same mistake in this file too: cluster.vue

When you're inside the data function, don't hang values directly off of this. Instead return the values you want to set as an object.

@sirlancelot I know it's not correct, That's why I said it's not a bug. I was just not paying attention when I wrote this code, and without any warning the "bug" was hidden until everything break. I posted this because I'm having another error now (which is different from this data() hook) and wanted to know if anyone has a hint.

I will remove data() hooks by created() ones in the next release.

@simplesmiler I, too, think it's worth the check on non-production mode. Those warnings are always helpful and makes Vue awesome. The doc is pretty clear IMO so there's nothing more to add

@GuillaumeLeclerc it may have something to do with this: https://github.com/vuejs/vue/issues/2520#issuecomment-199082346

Thank you @yy990803 I will check for something like this in the code.

Thank you for your help !

You were right I was using $data as a mix of _props and $data. How can I get this now. I saw there is vm._props but it does not looks like it's documented. Id'really like to write code that will not break in the next release of vue, can you give me any hints ?

@GuillaumeLeclerc I'm sorry about that, this change probably should've not gone in a patch release - but be assured that it's quite rare for such changes to happen in patch releases.

So for your use case - are you trying to enumerate over the props? Note you can get all prop keys from this.$options.props which is reliable.

Ok I'll do something like this:

const propsValues = Object.keys(this.$options.props).map((k) => this[k]);

and probably put it as a mixin

Looks good to me. Closing this for now - let me know if there are still unresolved issues for you when upgrading to 1.0.18.

Thank you again !

Everything is fixed in vue-google-maps

Was this page helpful?
0 / 5 - 0 ratings

Related issues

6pm picture 6pm  路  3Comments

loki0609 picture loki0609  路  3Comments

robertleeplummerjr picture robertleeplummerjr  路  3Comments

bdedardel picture bdedardel  路  3Comments

loki0609 picture loki0609  路  3Comments