Fork me on GitHub

another question, maybe for the re-frame devs? i'm playing again with the :<- [:some-sub] macro. in my scenario i have a one sub that accepts a single parameter (a key pointing to somewhere in app-db). i have another subscription that accepts the same parameter (in fact all my subs do.. this is an embeddable component). it looks to me like the macro doesn't forward the parameters that are given to the "parent" subscription. is that correct?


for example, i can't use the macro here because db-path isn't passed to the three subscriptions:

  (fn [[_ db-path]]
    [(subscribe [:im-grid.subs.pager/page-num db-path])
     (subscribe [:im-grid.subs.pager/page-limit db-path])
     (subscribe [::results db-path])])
  (fn [[page-num page-limit results]]
    (when (and page-num page-limit)
      (take page-limit (drop (* (dec page-num) page-limit) results)))))


@joshk I believe that is correct and that you have to use the pattern in your example.


currently trying to figure out how to refresh an access token upon launch, and it seems like a coeffect is the direction I should be heading but how does that work with asynchronous calls like a rest call since the result of a coeffect should be the updated state not a promise?


@benny there are two different ways suggested to make requests, an effect that makes the requests and bind the promise functions to dispatch events on success and failure. And a subscription.


perfect, that helps a ton, thanks @musheddev


@benny i have an app that requires a token and a few other assets as well (in order), and i also delay all routing until the assets are fetched. i use an effect provided by the re-frame folks that helps keep everything in order:


I was just looking into that now that I’ve gone through more documentation on effects, coeffects, interceptors, etc


do you then use a timeout to refresh?


i think we just swallow the routing event until the finished-loading-assets event is seen


wow, very helpful! thanks @joshkh


if nothing else, validation around some things that i’m only trying to understand conceptually right now


no worries. i ask a lot of dumb questions here so take my advice with a grain of salt 😉


more specifically 43


so thanks again!


happy to help!