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

Docs: Storing model instances in components #113

Open
majdal opened this issue Apr 18, 2019 · 1 comment
Open

Docs: Storing model instances in components #113

majdal opened this issue Apr 18, 2019 · 1 comment

Comments

@majdal
Copy link

majdal commented Apr 18, 2019

I'm trying to find out how to fit vue-mc into my app's architecture, and the docs are helpful, but maybe I am missing something obvious:

In the Vue docs data section, it reads:

A rule of thumb is that data should just be data - it is not recommended to observe objects with their own stateful behavior.

Where should I store my model instance otherwise? That's the "vue-ful" way of doing so?

I'd be happy to add the results of this discussion to the vue-mc docs if the maintainers see that it's appropriate.

@rtheunissen
Copy link
Collaborator

rtheunissen commented Oct 8, 2019

I think the vue-ful way is to create components granularly and have your own HTTP modules, etc. A vue app done right probably doesn't need a package like vue-mc. In practice, we found that that is harder to achieve than we anticipated, so vue-mc helped to abstract a lot of duplicated patterns. The idea was that vue-mc is just a proxy to "just data", ie. it does what a component would do in its methods, except that the logic is moved to another module that can be isolated from Vue (for the most part), shared, and tested.

We didn't want vue-mc to maintain "state" and observers other than those automatically added by Vue. It just encapsulates the data for components. I don't believe that this fundamentally defies "the vue way", but also perhaps not a perfect fit.

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

2 participants