-
Notifications
You must be signed in to change notification settings - Fork 2
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
Embrace Vuex? #6
Comments
YES Please! Maybe we can add a mini-elmish on top of the store (mutations = msgs, actions = commands), although I am not sure how performance goes if we don't mutate but create a new instance of the state type instead like we do with react. data communication is another concern |
Maybe we can do something as it's done here but in a nested fashion to only mutate the fields that have actually changed. What do you mean by data communication? |
Sounds like a plan
I assume the state of the store will be a big record type with field having the type of the states of the children, so I was wondering to extract the child states from the store in a type-safe manner. I have to play around with the code to get a feel for it ;) |
Seems Vuex has the concept of modules, but I assume we don't need really them when using typed records for the store model. Maybe we can add a We can try things on the go, I'm sure that as we add pieces to the puzzle (router, etc.) we'll realize we've missing things anyways :) |
Writing here as active user of both F# and Vue.js =) Will be glad to help as well, and here are some thoughts.
|
Hello there @Lanayx, thanks for chiming in on the subject matter and your help is really appreciated if we could make something nice out of this because my own knowledge of vue.js is quite limited Let me go through your points
This is the plan, we are currently trying to see how to make a binding on top of vuex that can be used in a type safe manner, preferably using union messages and update functions. I am playing around with it now but it still not entirely clear how the mapping should be done. Or are you suggesting to literally keep using vuex as is by defining mutations and actions?
I guess waiting for the features to stabilize first would fine for now, there still quite a lot to figure out on how to make this work nicely in a type-safe way
Using these would mean that child components would know about the outer (parent) state types, just like @alfonsogarciacaro said, it would be ideal if a child component takes a
If we make
|
What I want to achieve with Fable+Vue is not another architecture, but the same architecture, ideally only thing that should be changed is js => fsharp similarly to how it is done using js => ts |
but keep fable.vue (core) and fable.vuex as separate packages 🤞 |
Thanks a lot for your comments @Lanayx! I'm also just starting Vue so your experience is really helpful 🙌 Do you happen to know an example of a medium-size Vue app using Vuex in a Trying to translate such an app to F# would be useful to see what kind of challenges will be facing and how also how most adequately can we bind to Vue concepts using F# as idiomatic as possible. |
@alfonsogarciacaro Ok, I'll provide two examples for both real-world app as well as standard approach in 1-2 days |
@alfonsogarciacaro And a real world example, that uses Nuxt on top of Vue.js which is a default choice for any sites with SSR requirement. What else was used: external components, store extension, more external libs, folder structure instead of router, middleware, some nuxt-specific hooks (fetch, nuxtServerInit), constants as names for actions, mutating state in actions, cross-module communication. Unfortunately I can't provide server for this. One of the ideas for Vuex with Vue is that you are free to choose between local component data and Vuex in case several components are involved. |
This is great @Lanayx, thanks a lot! This is going to be tremendously helpful 🏅 |
Seems the standard tool for state management in Vue ecosystem is Vuex, should we use it or try to implement Elmish for Vue instead? (Maybe we could event adapt Elmish to Vue.)
Some of the benefits of Vuex are the integration with the Vue devtools and apparently some performance improvements too.
The text was updated successfully, but these errors were encountered: