Fork me on GitHub
#re-frame
<
2021-08-29
>
lmergen14:08:53

hey all, i'm trying to figure out a bit about structuring subscriptions which i wasn't able to find an answer to in the docs. now, i fully understand the difference between layer 2 and layer 3 subscriptions, but what i don't understand is whether or not i am allowed to have multiple layer2 subscriptions, or multiple layer3 subscriptions, or whether it's better to just decompose those things using functions. e.g. i could have a bunch of layer2 subscriptions which consume each other, each being very trivial. then i could have a layer3 subscription which does a lot of computation, which is also consumed by other layer 3 subscriptions which do even more computation based on its input. is this a common practice, or would it be better to "compose" these things using functions, not subscriptions? i assume it's mostly about the overhead involved in managing complex subscription hierarchies

p-himik14:08:31

> a bunch of layer2 subscriptions which consume each other They would become layer 3 then. Layer 2 subs don't have any signal subs. As far as I can tell, it is a common practice. Composing using functions will not really achieve anything but will make some thing slower because there can be repeated computations, whereas subs cache their values.

lmergen17:08:00

ok, so anything that doesn't operate on the db directly is effectively a layer 3 sub

lmergen17:08:28

thanks for the info 🙂