Fork me on GitHub
#om
<
2016-07-19
>
hlolli09:07:30

@ag Here you see all tags: https://github.com/omcljs/om/blob/master/src/main/om/dom.clj#L4 what do you need custom html tag for?

ag14:07:29

@hlolli: I’m trying to render a web-component inside react/om.next component. It’s basically a custom tag. For some reason “transclusion” not working with Sablono. I was hoping it may with om.dom

hlolli14:07:57

you mean jsx tag?

niamu18:07:29

Several days ago I was asking about the possibility of using Hiccup/Sablono syntax with Om Next and Cellophane. Today I’m happy to declare that I have a working demo of that. https://gist.github.com/niamu/43c0e9a7c3dd2a10c061a905ab3042ae

niamu18:07:42

Hickory made things easy.

ethangracer19:07:36

Can anyone confirm what I believe to be a bug in db->tree:

(deftest test-numbers
  (let [state (atom {:union-join   [:panel :a]
                     :union-join-2 [:dashboard :b]
                     :dashboard    {:b {:x 2 :y 1 :z [:dashboard :c]}
                                    :c {:x 3 :y 7 :z [:dashboard :d]}
                                    :d {:x 5 :y 10}}
                     :panel        {:a {:x 1 :n 4}}})
        query [{:union-join-2 {:panel [:x :n] :dashboard [:x :y {:z '...}]}}]
        expected-result {:union-join-2 {:x 2 :y 1 :z {:x 3 :y 7 :z {:x 5 :y 10}}}}]
    (is (= expected-result (om/db->tree query @state @state)))))
;; returns {:union-join-2 {:x 2 :y 1 :z {}}}

ethangracer19:07:18

seems to be an issue with recursion nested in a union query

ethangracer19:07:16

the direct recursive query works fine

[{:dashboard [{:b [:x :y {:z '...}]}]}] —> {:dashboard {:b {:x 2 :y 1 :z {:x 3 :y 7 :z {:x 5 :y 10}}}}}

donaldball21:07:04

I’m still struggling up the hill of om.next mastery, so please let me know if what I’m asking for seems incorrect in some way. As part of our authentication flow, we want to open a popout window and refresh some remote data when the window closes. After a couple of different arrangements that are more or less unsatisfactory, I’m thinking that the Right Thing to do is to have a component that opens a window when a particular state transition occurs, watches the window’s status in a go-loop, and applies a transaction when it closes. I’m not sure what lifecycle protocols I should hook into to set this up correctly though. Any advice?

mahinshaw21:07:24

@donaldball: If you have a go-loop that exits, then there is no reason why you couldn’t just run a transaction at the end. We have been using a dedicated end point for our auth (oauth), and redirects back to the index.

donaldball21:07:07

The place where I have the window opening and the go-loop right now is in a send-fn callback. If I were to apply a transaction at that point, I’d need a reference to the component or the reconciler, which I don’t have, right?

mahinshaw21:07:44

Do you have the reconciler

mahinshaw21:07:51

because you could transact with that

donaldball21:07:34

I don’t, and I don’t even know how I’d thread it in. The send-fn impl would need a reference to it, but that feels weird because the reconciler owns the send-fn. Ultimately, it feels like opening a window is a UI thing and it really ought to happen in a component, I just don’t know enough about the react lifecycle events or how om manages them.

mahinshaw21:07:48

Could you just use a dom event? I have had to hook into those for drag and drop. We’ve moved away from lifecycle things unless totally necessary (in most cases)

donaldball21:07:48

Can’t think of what dom event I’d use tbqh. I can’t open the auth popup window until the user has requested and received an auth url.

mahinshaw21:07:47

Are you using websockets? Is that why you have a go-loop in the send-fn? Sounds like you might want to move this out of the send-fn

donaldball21:07:55

No, the only reason for the go-loop is to poll for the window closing. It appears you can’t receive events from windows that open across domains.

donaldball21:07:39

But yes, your critique is correct, I think: I’m trying to find a way to express this in an om ui object.

mahinshaw21:07:28

Yeah, hanging out in the send-fn might not be the best idea.

mahinshaw21:07:31

You could use an app state marker to do the notification

donaldball22:07:46

Right, but it’s not clear to me how, if at all, I could trigger an effect in my ui component only on a given state transition

donaldball22:07:34

I could open the window in the send-fn and put a ref into the app state for the ui to watch, but, eh, that still feels like like the wrong place

anmonteiro22:07:51

@ethangracer: seems like a bug. investigating

anmonteiro23:07:45

@ethangracer: confirmed it’s a bug with singletons in data. vectors work well and are well tested

ethangracer23:07:33

@anmonteiro: huh, what singletons — the union idents? want an issue for it?

ethangracer23:07:33

i tried tracing a bit in the code but got lost 😅

anmonteiro23:07:49

@ethangracer: singletons in the recursion. in your example :z [:dashboard :c] instead of :z [[:dashboard :c]] which would work

ethangracer23:07:03

ahh very interesting

anmonteiro23:07:03

I’ll open the issue, got a more minimal case

ethangracer23:07:48

great, thanks