Fork me on GitHub
#fulcro
<
2019-08-26
>
bbss02:08:17

Great! That's working for the maps, I should be trying to port the aws-amplify withAuthentication hoc soon. Thanks!

sif03:08:23

Any chance that some one succeeded on running F3 on RN or with expo? an example on how to mount the app and register the root component would much appreciated, I wasn't able to

tony.kay03:08:52

@sifou I don’t do any react native. It is likely we’ll have to do a patch or two. Look in application.cljc…the render stuff is all pluggable.

tony.kay03:08:29

we’ll probably have to patch mount!

tony.kay04:08:45

and you’ll definitely need to set the application options for :render-root! and :optimized-render!

tony.kay04:08:22

@bbss Should be similar…but don’t follow their advice and wrap Root…Root is special in Fulcro, but you should be able to make a component just under root and use the pattern there.

👍 4
bbss07:08:11

I'm not sure if I'm doing something wrong, but since my router seems to work fine if I manually specify a ::dr/id for the router in the initial state of the root component I thought I'd mention. If I don't do that it causes route-deferred to never succeed as it can't find a router id when the target-ready is called.

tony.kay15:08:22

@bbss likely something you’re doing wrong…using DR in a number of places/projects…though admittedly not deferred routing much

bbss15:08:37

Alright, I'll keep digging 🙂

tony.kay15:08:11

feel free to post example

tony.kay15:08:42

@bbss make sure you understand initial state. You do have to compose the initial state of the routers to root, just like anything else that appears in the app at startup.

tony.kay16:08:30

Also, remember that initial state is initial state…it is the “first frame” of rendering. The legacy union router does go through and use the initial state from all branches, but the dynamic router does not (because it gives you a mechanism to set up state on entry). Nested routers could require a bit more work to get into app state correctly.

tony.kay16:08:18

That is an area of D.R. that I’d be willing to expand (if we can come up with a proposal for what should be done).

bbss16:08:23

I don't have all my data compose to root, does the router expect initial state to match the query? I usually guard in my component (and now in the will-enter) with filler data or so.

tony.kay16:08:47

If you make an initial state as a lambda, you should typically call get-initial-state on the child, not manually enter it.

tony.kay16:08:32

:initial-state {:root/router {}}

;; MEANS

:initial-state (fn [_] {:root/router (get-initial-state RootRouter {})})

tony.kay16:08:38

but not vice-versa

tony.kay16:08:50

Routers have initial state defined internally

bbss16:08:05

Okay, so there's some meta data missing if not using get-initial-state?

bbss16:08:59

Yes, I think that was it, using get-initial-state in the lambda seems to work as well 🙂. I think I'll keep that in mind, might have been bitten by not using get-initial-state before.

tony.kay16:08:45

it’s not meta-data…it’s the actual data that was declared on the target component as initial state

tony.kay16:08:23

defsc supports a non-lamba shorthand that rewrites it to eliminate boilerplate, as shown above

wilkerlucio16:08:24

@bbss also, if you are looking for a solution to augment data at component level (not just at first frame, but also as response to load or merge-component) you should check :pre-merge

4
bbss16:08:15

Alright, thanks for the tips!