Fork me on GitHub
#re-frame
<
2018-09-25
>
dangercoder05:09:48

Hey guys I am a bit stuck. Getting the following error:

Invalid arity: 0 
using https://github.com/Day8/re-com/blob/master/src/re_com/modal_panel.cljs with a subscribe. Anyone encountered something similar?

curlyfry06:09:44

@jarvinenemil Could you show us how you use it?

dangercoder06:09:10

(defn main-panel
  []
  (let [active-panel (rf/subscribe [::subs/active-panel])]
    [re-com/v-box
     :height "100%"
     :children [
                (let [game-popup @(rf/subscribe [::subs/queue-popup])]
                  (infof "Got data %s" game-popup)
                  (if (empty? game-popup)
                    nil
                     [re-com/modal-panel
                                       :backdrop-color   "grey"
                                       :class "play-modal"
                                       :backdrop-opacity 0.4
                                       :child            []]))
                [header]
                [re-com/h-box
                 :children [

                            [re-com/h-box
                             :children [
                                        (let [user @(rf/subscribe [::subs/user])]
                                          (if (empty? user) nil (side-navigation-bar)))

                                        (condp = @active-panel
                                          :sign-up   [sign-up/sign-up-panel]
                                          :home [home-panel])
                                        ]]]]]]))

dangercoder17:09:08

I ended up creating my own solution drawing inspiration from https://github.com/benhowell/re-frame-modal @U0J30HBRS :flag-se:

curlyfry18:09:27

Cool! :flag-se::flag-se::flag-se:

dangercoder06:09:01

(I put it in the main-panel for the example, I will put it in another component so I don't have to re-render everything later on 🙂)

urbanslug12:09:45

Does re-frame provide a way to save/read say session info from localStorage or does one handle that themselves?

akiroz13:09:01

@sveri Kinda late now but I actually made a library for persisting app-db in local-storage a while back: https://github.com/akiroz/re-frame-storage

akiroz13:09:34

Oh @urbanslug maybe you could also check this out, see if it works for you ☝️

talgiat17:09:11

Large re-frame application structure We have a pretty large re-frame app (30K LOC), and we’re trying to break it into separate modules that can be lazily loaded. Few problems we run into trying to analyze dependancies (this assumes breaking the app into multiple panels as mentioned here: https://github.com/Day8/re-frame/blob/master/docs/Basic-App-Structure.md#larger-apps): 1. Events and Subscriptions were not fully qualified keywords so they did not require to require their respective panel subs namespace when being used. 2. Panel ‘Instances’ - Think about the following use case: dashboard with widgets. A user can have the same widget on the dashboard with different configurations. Hence from re-frame code perspective it’s one panel, but this panel has multiple ‘instances’. Each panel instance will have its own key in the app-db. The problem here is how to subscribe to that specific panel instance subscriptions or dispatch that specific instance events. We thought about few solutions but none of them is great. I would love to hear some ideas regarding both issues. @mikethompson I remember you mentioned in Google Groups (long time ago) that your re-frame app uses dashboards with widgets, so I’m believe you had to solve a similar problem.

rnagpal19:09:05

Can we get the old value and the new value of a reframe subscription ?