Fork me on GitHub
#fulcro
<
2019-06-08
>
Thomas Moerman10:06:20

An application design question: when navigating to a page, i have a pre-route transaction that performs a pruned load (excluding a large table). After arriving on the page, I want to incrementally load that large table automatically. Is it reasonable to launch that load in a :componentDidMount callback function? Or is there perhaps a better "hook" for this kind of situation? Thanks.

hmaurer15:06:31

@thomasmoerman by incrementally do you mean load more data for the first few rows, then the next few, etc?

hmaurer15:06:40

or is it two steps: (1) load pruned query data (e.g. which contains length of table), then (2) load all data?

currentoor18:06:33

@thomasmoerman the recommendation in general is to prefer calls to load in the event that triggers the routing change in case react has to re-mount your component, that said using componentDidMount is not the worst thing you could do i sometimes use, especially when i’m prototyping

currentoor18:06:15

however, i strongly prefer using the dynamic router, which has a hook for doing exactly this type of thing

currentoor18:06:06

for not now it’s in the incubator

currentoor18:06:13

but fulcro3 is going to have it natively

👍 4