Vue-next: Standardizing language for state/data/observable

Created on 5 Mar 2019  路  4Comments  路  Source: vuejs/vue-next

Since data in components, state in Vuex, and Vue.observable are all used to register observable state objects, I wonder if we should standardize the language we use to reduce the number of concepts people have to learn. My personal preference would be to settle on state, since this is also the word generally preferred in the React and Angular ecosystems, thus easing migration. So the total renames would be:

  • data/$data -> state/$state
  • Vue.observable -> Vue.state

The obvious downside is the adjustment pain for current users, but I think that could be mostly alleviated by a period of allowing the old names to work as aliases, while emitting a warning if they're actually used.

Most helpful comment

Me likey.

The obvious downside is the adjustment pain for current users, but I think that could be mostly alleviated by a period of allowing the old names to work as aliases, while emitting a warning if they're actually used.

This is the most important part for me.

We still have to remember that we are promising to keep the API mainly intact for v2 -> v3, and while I agree that it makes sense to standardize this, we have to keep the old names working, but deprecate them so we can drop them in v4.

  • Vue.observable -> Vue.state

Not too sure about this one, I like the expressiveness of observable(), it makes state observable (even though I think RxJS folks don'T like the name at all ^^)

All 4 comments

I like the idea. Was hesitant because we have been using data for so long but I agree state actually makes more sense.

Me likey.

The obvious downside is the adjustment pain for current users, but I think that could be mostly alleviated by a period of allowing the old names to work as aliases, while emitting a warning if they're actually used.

This is the most important part for me.

We still have to remember that we are promising to keep the API mainly intact for v2 -> v3, and while I agree that it makes sense to standardize this, we have to keep the old names working, but deprecate them so we can drop them in v4.

  • Vue.observable -> Vue.state

Not too sure about this one, I like the expressiveness of observable(), it makes state observable (even though I think RxJS folks don'T like the name at all ^^)

@LinusBorg That's essentially by problem with observable. 馃槃 It doesn't return an "observable" the way most of the rest of the ecosystem thinks of them, but rather a reactive state object.

Closing this since we are no longer touching 2.x options, and Vue.observable renaming should now be part of the function-based API discussion.

Was this page helpful?
0 / 5 - 0 ratings