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

Profile Settings inputs v-model current user state #387

Open
arivictor opened this issue Jun 16, 2020 · 0 comments
Open

Profile Settings inputs v-model current user state #387

arivictor opened this issue Jun 16, 2020 · 0 comments

Comments

@arivictor
Copy link

arivictor commented Jun 16, 2020

Fairly new to Vuex and vue in general but I noticed in Settings.vue that the inputs v-model the currentUser state. This means that if I modify the input it is already directly mutating the state (is this a no-no?).

Which leads onto the button that then sends this.currentUser back to the store, even though the store was already modified via v-model.

<input
     class="form-control form-control-lg"
     type="text"
     v-model="currentUser.username"
     placeholder="Your username"
 />

I tested this by simple displaying `{{ currentUser }} and you can see it being directly modified when the input changes.

Again, new to Vuex/Vue, but I just went through a whole heap of guides saying not to directly mutate the state, instead use an Action -> Mutation -> State.

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

1 participant