Fork me on GitHub
#fulcro
<
2017-11-15
>
tony.kay06:11:04

@thosmos Resolving deps problems. You know how to use lein deps :tree? Basic process I use is this: 1. Remove any exclusions from the deps in the project file. 2. Run lein deps :tree. You’re looking for conflicts where more than one thing wants different versions. You have a choice to resolve them: 3a. Add the more recent of the conflicting versions to your own project (possibly commenting it as a forced resolution). This does a nice job of resolving multiple things, but you want the note so you can re-check them when upgrading versions. 3b. Add exclusions to all of the libs that want an older version. This can still cause problems if the versions are different enough. 4. Repeat starting at (2) every time you make a change.

tony.kay06:11:29

it is important that you do (1) though if you’re having problems. Could be that the existing exclusions are hiding conflicts you need to analyze

roklenarcic09:11:40

Forms dropdown-input requires I specify list of options at declaration time (in IForm implementation). What if dropdown is a list of entities that changes/is loaded from db?

cjmurphy09:11:59

You can do that too, just have to see the data structure and change it.

roklenarcic09:11:23

well, yes, I can change form structure after the fact on per entity instance basis

cjmurphy09:11:03

I created what I called an options generator and another thing I called a drop-down rebuilder.

cjmurphy10:11:30

All this code quite dependent on the internal structure inside the forms key, which is going to be normalized at some stage.

wilkerlucio13:11:22

hey guys, had any of you had any problems with the Fulcro remote queue? I've a project where it seems to be losing some messages on the channel, only when I have a project used into a bigger one, normally it works, but on adv compilation injected into a bigger project (that includes re-frame and many other things) the queue goes bad

rastandy13:11:20

hello guys, I have some doubts about how to implement breadcrumbs. I have the concept of a page which has a title. I imagine that I could add a :page/parent property in the query which is a link to the parent page (when I’ll be able to grok how to do recursion in the om.next query syntax). What I can’t still imagine, is how to manage pages which have “dynamic” titles, i.e. titles based on some other properties, for example a [:app/current-file _] singleton or so…

claudiu14:11:36

@rastandy Not 100% sure if I get what you mean by breadcrums. But instead of recursive query, is adding the data in the format that you need in a place in the state an option ? (move the processing in the router for example)

rastandy15:11:40

hello @tcaludiu

rastandy15:11:50

I’m not sure I understood what you mean

rastandy15:11:06

do you have an example?

rastandy15:11:23

@caludiu yeah now I got it

rastandy15:11:00

yes, that is certainly an option if I can’t with recursive queries

rastandy15:11:15

@claudiu thanks for your help!

claudiu07:11:32

you're welcome 🙂

rastandy13:11:31

any idea? 🙂

gardnervickers14:11:10

@wilkerlucio are you eliding asserts?

gardnervickers14:11:17

We had a problem with that in the past, never tracked down the root cause but disabling cljsbuild from removing asserts in our adv. build fixed it.

wilkerlucio15:11:44

@gardnervickers right on spot man!!! Thanks you so much! I was driving crazy by this one. If we ever met in life I would like to buy you a beer or something 🙂

gardnervickers15:11:48

Haha no problem its the weirdest thing, Tony and I tried debugging it a while ago and I came to the conclusion that it was a race condition in my app, but now that you're seeing it too it's probably worth taking another look.

wilkerlucio15:11:15

maybe there is something in core.async that needs asserts to work propery?

wilkerlucio15:11:27

I was debugging it yesterday, and it made no sense

wilkerlucio15:11:41

I could see (via a map transducer) that the items were getting in the channel for sure

wilkerlucio15:11:52

I was looking with this

wilkerlucio15:11:55

(defn start-network-sequential-processing
  "Starts a async go loop that sends network requests on a networking object's request queue. Must be called once and only
  once for each active networking object on the UI. Each iteration of the loop pulls off a
  single request, sends it, waits for the response, and then repeats. Gives the appearance of a separate networking
  'thread' using core async."
  [{:keys [networking send-queues response-channels]}]
  #?(:cljs (js/console.log "START NETWORKING PROCESSING"))
  (doseq [remote (keys send-queues)]
    (let [queue            (get send-queues remote)
          network          (get networking remote)
          sequential?      (is-sequential? network)
          response-channel (async/chan)
          send-complete    (if sequential?
                             (fn [] (go (async/>! response-channel :complete)))
                             identity)]
      (go
        (loop []
          #?(:cljs (js/console.log "BEFORE ENTER QUEUE STATE" (count (buffer-str (.-buf (.-buf queue))))))
          #?(:cljs (js/console.log "ENTER LOOP, WAITING FOR MSG"))
          (let [payload (async/<! queue)]
            #?(:cljs (js/console.log "AFTER TAKE QUEUE STATE" (count (buffer-str (.-buf (.-buf queue))))))
            #?(:cljs (js/console.log "SEND PAYLOAD" (pr-str payload)))
            (send-payload network payload send-complete) ; async call. Calls send-complete when done
            #?(:cljs (js/console.log "AFTER SEND QUEUE STATE" (count (buffer-str (.-buf (.-buf queue))))))
            (when sequential?
              (async/<! response-channel)) ; block until send-complete
            #?(:cljs (js/console.log "AFTER SEND RESPONSE STATE" (count (buffer-str (.-buf (.-buf queue))))))
            #?(:cljs (js/console.log "PAYLOAD SENT, GET NEXT"))
            (recur)))))))

wilkerlucio15:11:25

what I found intriguing, is that before reading the response-channel, the message was in the channel

wilkerlucio15:11:43

but after reading the response-channel, the queue lost the item

gardnervickers15:11:55

Yes I came to the same conclusion

gardnervickers15:11:24

Things are placed on the channel, but one of the items is lost, it's always the first or second though I can't remember which.

wilkerlucio15:11:54

in my case it was always the second

rastandy15:11:48

I’m able to obtain breadcrumbs from pages which have statically defined title with this component:

rastandy15:11:22

but what about “dynamic” titles? Like for example a page title obtained from the current viewed file name?

wilkerlucio15:11:47

@rastandy if you add ident to it, you can change the title by changing the app state

rastandy15:11:03

@wilkerlucio can you please expand on that? I’m not grasping the idea…

wilkerlucio15:11:26

in the end you are always rendering from some data, I'm still trying to grasp what you mean by dynamic, isn't everything dynamic via the data? what makes one case different from the other?

wilkerlucio15:11:18

my suggestion is to give the component some ident, so you have an easier time to edit the content, otherwise you may have to do some crazy processing on the data

rastandy15:11:20

@wilkerlucio I see two cases, one when data is obtained from the Fulcro’s initial-state method, and the other one which is based on some “not present at startup” state

rastandy15:11:08

my component already works with pages that define their initial state like this:

rastandy15:11:26

(initial-state [clz params] {:page/id :page/about, :page/title “About” :page/parent [:page/home :page]})

rastandy15:11:54

and then the breadcrumbs are easily obtained by a query like this:

rastandy15:11:27

[{[:page/about :page] (om/get-query Breadcrumb)}]

rastandy15:11:36

@wilkerlucio btw, I’ll think about your suggestion, It will help me understand better how things work

rastandy15:11:57

@wilkerlucio thanks for your help

wilkerlucio15:11:18

no problem, sorry the delay, I'm doing stuff at work too 🙂

wilkerlucio15:11:30

but I recommend you create some id for each entry

wilkerlucio15:11:40

this can help on the navigation, the breadcrumbs can point to each other

wilkerlucio15:11:53

then it's just a matter of editing the app state to change the titles

rastandy15:11:15

@wilkerlucio uhm, your last sentence maybe made it more clear

rastandy15:11:53

@wilkerlucio yes, I need to figure it out but I see a path to follow 🙂

rastandy15:11:50

@wilkerlucio will try something at home. Now I’m running away because I need to take a train

rastandy15:11:59

thank you again guys

wilkerlucio15:11:26

no problem, have fun 🙂

claudiu17:11:07

Thinking maybe fulcro would also benefit from a topic there :)

thosmos18:11:13

I've been experimenting with the fulcro-template example app. I like how many different pieces and elements are included, especially the server-side rendering! That took me ages to get working on the one production CLJS app I've done.

thosmos18:11:20

Question: it looks like the SSR app-state is manually assembled to some degree, like manually adding the :current-user value to the state map and normalizing it. What I'm familiar with is having a full root query from the client and using the server Om query parser to get the full query result in one go, and then normalizing it. Is this just how this one app works, or is this the suggested Fulcro way of building the app-state server-side, in general?

thosmos18:11:50

I have more reading and watching of tutorials to do, so I hope this isn't too much of an FAQ question

claudiu18:11:47

@thosmos The ssr adding to state is a bit more manual. Think there might be some helpers on the way in v2. 🙂 SSR is optional.

thosmos18:11:30

good point

claudiu18:11:10

On the client mostly load and load-action from the data-fetch namespace. They take care of normalization of the data that comes from the server 🙂

claudiu18:11:06

Intersting thing is that: mutations will always be sent first and the reads after.

thosmos19:11:55

I'm currently watching the videos and will go through the devguide next. I'm so impressed! After having hacked my way through a full stack om.next production app, it's a joy to see so many essential things thought about and included.

claudiu20:11:29

@thosmos Same here. Never written a production app in clojurescript except for fulcro (played rum, re-frame a bit). Finished my first decently sized fulcro production app, can't really believe just how simple and clean it is.

roklenarcic22:11:36

claudiu, my biggest problems are when parts of application reference each other (leads to tricky situations of what includes what), and when you have multiple components with the same ident, but different forms fields