Fork me on GitHub
#fulcro
<
2017-09-02
>
tony.kay07:09:24

Hey there. Your query is not composed correctly. All I can tell you is to re-read the dev guide and watch the videos. There are explicit (and simple) rules for composition, and you are not following them. Line 98: you compose Company instead of CompanyList. Line 31 you don’t make a join to something you’re trying to compse in…your initial state doesn’t place the child state at a key that matches the query. etc .etc.

tony.kay07:09:43

There is no magic here. It is not going to read your mind about what you want to do. The composition is a tree: in query, in initial state, and in prop extraction. It is all mirrored, and all joined together. The point is that your Root component will end up with everything as a tree at start (query and initial state). The startup process then turns that into app state.

tony.kay07:09:47

I’m not sure how to improve the docs/videos, but am open to suggestions once you “get it”. Have you used the dev guide and done the exercises? Have you watched the videos? I realize it is all kind of new and foreign, but everyone that works through it has a sudden realization at some point that it is about 10x simpler than they initially thought.

tony.kay07:09:13

Perhaps I’ll make a slower paced “beginners” video, and do more careful slow hand-holding to try to get the base concepts to sink in. The new core concepts videos on YouTube were meant to help with this, which is why I’m asking if you’ve watched them. I really strongly recommend that.

denis-v09:09:23

I went through the Dev Guide up to the end of E UI Queries and State Exercises, before jumping to the Forms sections. In your comment about line 98, you say its should compose to CompanyList instead of Company. But the example in the middle of E UI Queries and State (not the Exercises) shows a Root query going directly to Person and bypassing PeopleWidget. So I'm a bit confused.

denis-v09:09:44

Also I don't really understand what you mean in your comment about line 31.

denis-v09:09:38

I don't use videos much, but I had looked at the one at the top of the Getting Started page, which seemed just a quick overview, and I was wondering where all your videos were. But I hadn't noticed the 1/5 in the top-left, and I didn't realize there was a series of them. However I will look at the Core Concepts one tomorrow.

tony.kay16:09:04

@denis-v Composing bypass of CompanyList: Yes, you can do that. The InitialAppState confused me there, because if it doesn’t have a query, then it doesn’t have state…so adding initial state to it is inconsistent. I guess I have no idea why you have a CompanyName component, and line 31 is confusing because you query for a property :company/name but don’t join in the query for the component CompanyName. It is clear that there is confusion 🙂 Please do watch the videos. I think you’ll find them helpful, in that it really clarifies things to see them assembled in real time. The old Untangled video series may be of interest as well. The only difference for the most part is the name. There are a lot more of those videos, as I haven’t had time to build as many new ones yet.

tony.kay17:09:05

I started a cheat sheet for Fulcro. Comments and contributions are welcome: https://github.com/fulcrologic/fulcro/blob/develop/docs/CheatSheet.adoc

tony.kay17:09:24

It includes a sanity checklist for UI building that might be helpful for beginners.

claudiu19:09:17

@tony.kay Really cool, bookmarked. Not sure where it fits in, but would also include computed (the with let trick and om/factory).

claudiu19:09:07

was wondering is there any reason why post-mutations only have the state in the env (was hoping for component & ref to also be there) ?

tony.kay21:09:36

@claudiu Post mutations are not component centric. They are data centric. There is no component available at that part of the processing chain. The only thing that is sane to do right there is to morph data. The original load should have included refresh keywords for UI updates. Any data that is needed by post-mutations should be included in the post-mutation-params. Those are stored in app state as part of the marker, so it is unsafe to place anything but data there. If you must cheat (which again you really should not) you could add metadata to the post mutation parameters and put the component there. That should be preserved, and also not interfere with serializability of app state: (load ... {:post-mutation-params (with-meta {} {:component this}))

tony.kay21:09:10

But again, mutations and post mutations should be data-centric, not UI-centric as much as possible.