Fork me on GitHub
#fulcro
<
2019-07-23
>
jaide01:07:30

Hi there, I just want to prototype something on the front-end only. Is that easy to do with fulcro?

cjmurphy01:07:26

Depends on how quickly you can grasp normalisation /components / idents. See http://book.fulcrologic.com/fulcro3/#_fulcro_from_10000_feet

jaide03:07:53

Thanks for the link. Reading it now.

cjmurphy03:07:38

In F3 I'm doing a load from a button. As a parameter I'm passing a tree of data. i.e. reaching in to other components. This tree is not up to date with the state that I can see in Fulcro Inspect. I can make this tree up to date by pressing a different button that does a mutation that presumably refreshes these 'other component instances'. I can think of ways to try to work around this. But ideally I'd like to 'make sure this tree is refreshed in the UI' before doing the load.

tony.kay04:07:24

Ah, interesting scenario @cjmurphy. The new optimized render does, in fact, no longer patch the props tree like F2 did. You can switch to the keyframe renderer, and it will behave correctly for that scenario.

tony.kay04:07:42

well, also: Make sure you force refresh the parent, just like you would in F2. So, when whatever mutation is modifying the child in question, it should queue a refresh for the parent. I did add :refresh options to support that….so, in fact, it is still workable with the ident-optimized render. I was just hoping that ppl would not need to think about it.

tony.kay04:07:33

I’ve not had time to performance compare the two renderers, but I do expect that the overall overhead is significantly reduced so that the keyframe render should be fast in most cases.

cjmurphy05:07:35

The entity I'm wanting to have hydrated is a 'rule', and the component that needs the rule (where the button is) is its parent. I thought that keyframe render could help so the fulcro-app has options that include :reconciler-options {:render-mode :keyframe}. I can do a very small Fulcro application that tests this out.

cjmurphy05:07:17

The 'rule' is the thing that is a tree.

tony.kay05:07:54

See docs…that is not how to switch render in F3

tony.kay05:07:55

OMG…that markdown did not format well 😕

tony.kay05:07:32

The functions that are pre-written to do this are in nses under the rendering package

tony.kay05:07:45

e.g. keyframe-render/render!

cjmurphy06:07:56

Thanks for your help Tony. I fixed the problem by using computed and putting the transact! mutation that assembles the rule higher up (closer to the root of) the UI tree, remembering how important the 'this' transact! arg is is for rendering. Beforehand the transact! call was at the same depth on a different branch. No need to move to using the keyframe-renderer.

tony.kay14:07:40

of course explicit data-based refresh is still supported (i.e. follow-on reads) for indicating data changes elsewhere in the data tree