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

Large object field mapping #109

Closed
mrdigitalau opened this issue Jun 19, 2020 · 1 comment
Closed

Large object field mapping #109

mrdigitalau opened this issue Jun 19, 2020 · 1 comment
Labels

Comments

@mrdigitalau
Copy link

Hey mate,

Thanks for this spectacular plugin.

I have a question I can't seem to wrap my head around.

I have a large object, it's an application form.

I have an object like this (BUT much larger) in my store::

application: {
  fname:null,
  lname:null,
  email:null,
 phone:null
}

I have mapped it to my store
...mapFields(['application']),

If I create a text input and use v-model="application.fname", when looking inside of my Vue Chrome Plugin, the store isn't being updated, so I can't see the changes there, but if I echo the application object into my component {{application}} and see the raw data, it is being updated.

Is this correct way in doing this? Because it's such a large object, I really don't want to have to manually map every single field.

The way I've done it, even though it's not tracking the changes in the store, is it still acceptable to do it this way?

@geoidesic
Copy link
Collaborator

@mrdigitalau mapFields doesn't support that unfortunately. The way you are working with it breaks reactivity. The point of using a store is to share your data between components. If it's not in the store then you won't be able to do that. So it's up to you whether you need the store or not.

You might want to try dynamicMapFields as per #24 (comment). That way (provided you already have the list of fields as data in some format) you should be able to convert that to an array that can be mapped rather than manually mapping each field.

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

No branches or pull requests

2 participants