fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
2020-11-10T00:51:12.095400Z

@tony.kay yes

2020-11-10T00:52:37.095900Z

the subform's data prop is in the :form-fields set

2020-11-10T00:52:57.096400Z

if I edit the subform then edit the parent form and then do a diff from the parent form, it works

tony.kay 2020-11-10T01:07:40.099100Z

are you using set…!! ?

tony.kay 2020-11-10T01:07:50.099400Z

(double exclaim) or sync txns?

tony.kay 2020-11-10T01:12:02.101700Z

those do targeted renders to just the component in question. Shoot, that is trickier than I intended it to be when I added those. Use the single ! variants. The behavior really depends on which rendering strategy you’ve chosen (if you override the default) and if you use !!

2020-11-10T14:43:53.122300Z

I'm not sure what you're referring to with the double !!

2020-11-10T14:44:03.122500Z

I'm using functions like set-value!

2020-11-11T13:42:23.138900Z

It looks like the issue I was having in Fulcro 3.0.9 is fixed by 3.4.3.

stuartrexking 2020-11-10T09:48:31.105Z

I’ve created a datomic only port of the rad demo with 3.4.3 fulcro and integrant rather than mount. Everything works perfectly as expected, except I get this error (from the console) when I hard refresh on a path e.g (http://localhost:3000/accounts?_rp_=WyJeICJd&_). I don’t get the error with the Fulcro version from rad demo 3.2.17.

ERROR [com.fulcrologic.fulcro.routing.dynamic-routing:188] -  dr/target-ready! was called but there was no router waiting for the target listed:  [:com.fulcrologic.rad.report/id :ventures.fierce.rad.ui.account-forms/AccountList] This could mean you sent one ident, and indicated ready on another.

stuartrexking 2020-11-10T09:49:00.105300Z

If I route using the links it works fine.

stuartrexking 2020-11-10T10:27:32.105900Z

The error only occurs > 3.4.1

Helins 2020-11-10T10:56:04.114600Z

I am doing this more and more and I am not sure if this is the right thing to do or an anti-pattern. I often have components which displays a static set of things (eg. a header) as well as a dynamic set of things (eg. a panel selected amongst other). Keeping all data at the level of such a component, as opposed to splitting it across children, is often easier to handle and definitely keeps the cleanup logic simple when the component is discarded. My simple solution is to do a union on a prop specifying the dynamic thing (eg. which panel is selected). However, that dynamic thing is created on the spot in the DB (eg. when the panel is selected, dissoc'ed when unselected) and has only one prop: the ident of that parent component. When writing defsc for a given panel, it is then easy to fetch whatever props are needed from the master component. It works all right, but something feels off... Should it?

Helins 2020-11-10T11:07:54.115Z

Essentially, it does a union on itself, so to say (hopefully I am clear)

2020-11-10T21:25:43.123900Z

I have two components that have a different set of parents, sharing only the root. I need to share some data between them through a series of steps. Is a state machine a good option in such a case? The other option I can think of is storing some data in the root. Not sure which one is abuse of the system and which one is the better approach.

2020-11-11T13:32:07.138300Z

@cjmurphy I'm trying to make sense of you suggestions but it's not totally clear to me. I think I have some misunderstandings about the way components and their queries compose together. To describe my problem more, what I have is a Note , which queries :note/text and a CardList. The CardList queries just a :card-list/cards, and each Card has :card/text, which I need to be the same as the :note/text. The issues is that Note is not a parent of CardList, so I can't use a callback to grab the :note/text. > Could they both have the same join? By that I mean join to either the same component or different components that have the same ident. That way they both get exactly the same entity (for that join) in the props. Another thing you could look at is link queries.  So join the Card to the Note, while the Note queries for Card's parent, CardList? Am I understanding correctly? > You can repeat the same data all over your UI as much as you want. Isn't this what "side-banding" data is about, and is advised against in the docs? > All the steps needing to be done to the data could just be a mutation?? Ultimately, yes, but isn't the point of the SM to make things more simple when there are mutations that are connected through a series of events?

cjmurphy 2020-11-11T13:37:25.138500Z

I would just have :note/text, no need for :card/text. Do you need a Note table/entity/component? Put :note/text in the Card component.

2020-11-11T13:40:27.138700Z

A Note will have many Cards, and the :note/text should contain the original text, while Cards may have modified versions of the text from the Note they were created from.

2020-11-11T13:44:06.139100Z

@cjmurphy So the :card/text starts off as a copy of the :note/text, but it can be modified and should be diff-able against the original :note/text. That's why I chose to duplicate the text in the first place.

cjmurphy 2020-11-11T13:48:39.139300Z

So :note/text and :note/text-archives. Two attributes that could perhaps go into the same entity/component??

2020-11-11T13:51:40.139500Z

Where :note/text would always be the current text and :note/text-archives would be previous versions? Need to think about that a little, might be a possibility. The other consideration is that the original text and the current text need to be displayed in entirely different parts of the UI. I guess I could create two components that work off the same entity to achieve that?

cjmurphy 2020-11-11T13:57:23.139700Z

I was I guess just saying that it is quite idiomatic in Fulcro to have repeats in the tree that is your UI. If what you want to pull in is a singleton (component/id) then you can do it with initial-state. And for these relationships that form after start-up then the same thing can be achieved using a mutation.

cjmurphy 2020-11-11T13:59:52.139900Z

Yes two components that work off the same entity (so same ident) sounds good.

2020-11-11T14:01:14.140100Z

With all that considered, to my novice mind it still seems like a state machine would be helpful in passing data around disparate components. Is that correct? Is there a reason you seem to be advising against using a SM here?

cjmurphy 2020-11-11T14:02:15.140300Z

But it could also be the same component, repeated again, so joined into a different component. component just gives the 'look' obviously. You might want the same appearance and the same data twice in the tree. Or you may want same data and different appearance. In both cases the join component will have the same ident.

cjmurphy 2020-11-11T14:06:02.140500Z

Yeah wasn't advising against it. I'm no great expert on knowing when to use one or not. We all have to try using them and build up our intuition for them is all I can say there 😜

cjmurphy 2020-11-11T14:07:06.140700Z

Perhaps if you can already see the actors and states then its a good idea to go for it...

2020-11-11T14:09:07.141300Z

Thanks. Appreciate your input very much. I feel a little stuck on this part right now, going to work on another portion of the app for a while and then return to this a bit later, maybe restructuring my components a little bit. I've studied the EQL portions of the documentation and the EQL spec itself and know it pretty well, but putting it into practice is not intuitive for me just yet. Guess reading the docs can only get you so far, and getting your hands dirty is where the real learning happens.

👍 1
tvaughan 2020-11-10T22:45:06.124100Z

This https://clojurians.slack.com/archives/C68M60S4F/p1604836869080100 may be helpful

cjmurphy 2020-11-10T22:59:08.124400Z

@randumbo Could they both have the same join? By that I mean join to either the same component or different components that have the same ident. That way they both get exactly the same entity (for that join) in the props. Another thing you could look at is link queries.

2020-11-10T23:02:46.124700Z

Think I better return to this tomorrow morning with a fresh brain. Thanks for the input guys, I'll explore those options.