fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
NikolaMandic 2021-04-22T07:55:56.168600Z

hello I have a newbie question I'm having two components parent and child component I'm trying to update child component when state of the state machine changes without rerendering parent after adding query for component states in both components I see that the parent updates but child does not except when I pass the props to the child I'd like not to have query in parent component is that possible or am I just not doing it right? what i try to do in more detail is to inline add form to an inventory list and I added state machine so once you click on new button it triggers state machine change so component that has to render a change looks like this and this is not enough to have it fetch state machine state, that does get changed since parent component with the same query does rerender since I guess its on root of the router :initial-state (fn [params] [ ]) :query (fn [] [ (uism/asm-ident :newstuff)]) :ident (fn [] [:component/id ::inventory-add]) any tips appreciated

Jakub Holý 2021-04-23T17:15:58.197400Z

Yes, (lstadd/add-inventory-simple ) is indeed wrong, you always must pass props to sub components. That is a basic fact of React, which is under Fulcro. I see you use Link Queries, that looks like a weird thing to me. UI in Fulcro is a tree and so is the data that feeds it. A component asks its parent for the data it needs (via its query, which the parent must compose into its own query and so on all the way to Root), the parent in return supplies it its props. Sorry for the late response, I had not time.

Jakub Holý 2021-04-23T17:16:59.197700Z

Did you go through https://fulcro-community.github.io/guides/tutorial-minimalist-fulcro/ ? If it is not explaining these things clearly, I would be thankful for any tips on improving the clarity.

Jakub Holý 2021-04-23T17:17:48.198Z

PS: Next time consider using http://gist.github.com/ instead of pastebin, it has source code highlighting for clojure(script), which makes it easier to read.

2021-04-22T12:19:00.179Z

I started running into performance issues with a part of my app and am trying out the latest hooks (use-component/use-uism/use-root). I've adjusted some code so I can use a pre-existing ident: • pulling ident key from options in add-component and using that if available instead of calling get-ident • adding deps array to use-lifecycle so I can pass the (str ident) in use-component 's use-lifecycle deps It's improving performance a bit already, before I was using the use-query-subscription stuff which would go over a lot of stuff that it shouldn't. It cleaned up some places where I subscribed to ::uism/active-state of some sm a bunch. But I noticed now that's not properly working. Am I reading it correct and seeing use-component can only subscribe one listener per ident? If so I guess we need a place to add an id per use-component usage somewhere for ::app/render-listeners.

tony.kay 2021-04-22T14:51:35.179700Z

Are you using the SHA-based latest of 3.5? I just pushed some stuff last night on that.

tony.kay 2021-04-22T14:52:00.179900Z

I am aware of the problem with not using idents in the lifecycle…changing idents will cause problems. So, there’s a bit of work to do there as well

tony.kay 2021-04-22T14:52:20.180100Z

ae128d71d8bcdd36ffdbf43f26e35e5508ce8b6b

2021-04-22T15:36:02.180300Z

Ah no, wasn't using that sha, let me check it out.

2021-04-22T16:45:39.180600Z

made my earlier mentioned adjustments and the performance is now quite good with more room for improvements in having smaller queries, dropping way less frames!

2021-04-22T16:47:08.181Z

Still the issue remains of one of the use-component not getting updates (I think because I use the same ident in multiple use-component ?)

2021-04-22T17:11:44.181200Z

added an id to use-component so that's solved too 🙂

2021-04-22T17:19:00.181600Z

performance is better than it's ever been, this particular view has quite a lot going on. it has an image of text with ocr detection overlayed and can be zoomed/dragged/clicked and is in-sync with two scrollable lists, interacting back and forth with clicks/scrolls into view. Using a bunch of springs for animation as well. No wonder this needs a bunch of attention to keep running smoothly.

🎉 1
Jakub Holý 2021-04-22T18:55:28.182100Z

Sorry, I do not follow sufficiently. Perhaps if you could share the key pieces of the code, commented, in a gist? BTW, I noticed you use the lambda fform of query and init state. That should only be done if unavoidable not to loose helpful dev tips.

peterdee 2021-04-22T19:07:03.184900Z

In upgrading from fulcro 3.4.18 to 3.4.19 my app, running in dev mode with shadow-cljs and emacs, stopped connecting. It does not connect in 3.4.21 either. The log shows “An error occurred when calling (app.client.init) eval shadow.module.main.append.js:4.

peterdee 2021-04-23T13:56:31.193400Z

Thanks!

peterdee 2021-04-22T19:07:42.185600Z

I have had problems upgrading shadow-cljs too. I am stuck at 2.11.11. Maybe I should look at that first,.

NikolaMandic 2021-04-22T19:14:37.185700Z

thanks here is two components I try to render https://pastebin.com/aj6csSa6 listroot is parent component and addstuff is button rendered inside of it in fulcro template I added listroot to be rendered like so (lstt/list-root) now I am trying to rerender the button when it is clicked button triggers mutation and listroot indeed rerenders I am watching videos from Mr. Kay on fulcro trying to wrap my head around why doesn't the button render

NikolaMandic 2021-04-22T19:15:42.185900Z

I'm thinking if I just added query like in root component it will refresh just like root component but it might be that it references something else trying to wrap my head around it

NikolaMandic 2021-04-22T19:17:17.186100Z

I assume it should be possible by looking more at the videos but so far I failed to connect how exactly queries in subcomponents reference the state

NikolaMandic 2021-04-22T19:18:23.186300Z

u dont have to waste much time any tip at what you would look at would be helpful what comes first to your mind

NikolaMandic 2021-04-22T19:19:43.186500Z

once I pass it the props it does rerender but I'm like I guess its more elegant than that

NikolaMandic 2021-04-22T21:50:31.186900Z

I'm now thinking one has to pass the props to subcomponents. wonder if this is how it should be if author designed it this way

Jakub Holý 2021-04-22T22:20:47.187400Z

You can try asking in #shadow-cljs Check you are not pulling in multiple versions of cljs. Clean everything.

Tyler Nisonoff 2021-04-22T23:40:10.188400Z

is there a simple way to hook into RAD’s pathom parsers process-error for error reporting? or how are folks reporting errors from their RAD resolvers? (The answer may be, if you want something more complex, build your own parser / plugins?) Update: As Tony pointed out, Turns out RAD logs to log/err with the error, so a timbre appender can be used for this