Fork me on GitHub
#om
<
2016-05-01
>
tomjack02:05:34

@dimiter: one thing: you need a query on your root component

dimiter02:05:18

Even when I do that the subcomponents don't get re-rendered.

tomjack03:05:17

you have a new problem, then, I think

tomjack03:05:16

the root query should include (om/get-query AutoCompleter) and you should pass the props from that into AutoCompleter's factory

tomjack03:05:31

making that work does not seem like it will be trivial..

currentoor04:05:55

I’m getting some mutation issues when I turn on either simple or advanced compilation. Is that expected?

currentoor04:05:46

App works fine with whitespace compilation, and I’m doing any js interop directly.

currentoor05:05:18

I fixed it but I’m not sure how. When I had :simple compilation optimizations on, this code would throw a null error whenever a transaction originated from inside ui-widget.

[:div
       (ui-new-widget-menu (om/computed {:ui/widget-modal? widget-modal?
                                         :dash-id          id}
                                        {:toggle-widget-modal toggle-widget-modal
                                         :create-widget       create-widget}))
       (map #(ui-widget
              (om/computed % {:delete-widget delete-widget :dash-id id}))
            widgets)]

currentoor05:05:19

Then by putting the ui-new-widget-menu and ui-widget collection into seperate divs the null error when away.

[:div
       (ui-new-widget-menu (om/computed {:ui/widget-modal? widget-modal?
                                         :dash-id          id}
                                        {:toggle-widget-modal toggle-widget-modal
                                         :create-widget       create-widget}))
       [:div
        (map #(ui-widget
               (om/computed % {:delete-widget delete-widget :dash-id id}))
             widgets)]]

currentoor05:05:18

Well looks like it was a laziness issue, changing map to mapv also fixes it.

currentoor05:05:57

Maybe this is why David Nolen doesn’t like these dom dsls 😄

tomjack05:05:30

interesting

tomjack05:05:46

why would laziness there only break with optimizations, I wonder?

currentoor05:05:23

I wish I knew, probably a sablono issue though.

sergiodnila09:05:55

hi i’m trying this tutorial

but i got stuck on the second example of "Parameterizing Your Components” all i get as a result is “Hello 0” and the console shows this warning
Warning: flattenChildren(...): Encountered two children with the same key, `.$undefined`. Child keys must be unique; when two children share a key, only the first child will be used.warning @ react.inc.js:19287instantiateChild @ react.inc.js:4132traverseAllChildrenImpl @ react.inc.js:17621traverseAllChildrenImpl @ react.inc.js:17637traverseAllChildren @ react.inc.js:17709instantiateChildren @ react.inc.js:4158_reconcilerInstantiateChildren @ react.inc.js:11737mountChildren @ react.inc.js:11774_createInitialChildren @ react.inc.js:6958mountComponent @ react.inc.js:6804ReactDOMComponent_mountComponent @ react.inc.js:12403mountComponent @ react.inc.js:13065performInitialMount @ react.inc.js:5649mountComponent @ react.inc.js:5596ReactCompositeComponent_mountComponent @ react.inc.js:12403mountComponent @ react.inc.js:13065mountComponentIntoNode @ react.inc.js:11202perform @ react.inc.js:16006batchedMountComponentIntoNode @ react.inc.js:11223perform @ react.inc.js:16006batchedUpdates @ react.inc.js:9262batchedUpdates @ react.inc.js:13735_renderNewRootComponent @ react.inc.js:11376ReactMount__renderNewRootComponent @ react.inc.js:12403_renderSubtreeIntoContainer @ react.inc.js:11453render @ react.inc.js:11473React_render @ react.inc.js:12403(anonymous function) @ core.cljs:13
utils.cljs:38Figwheel: trying to open cljs reload socket
any clues why isn’t showing the tree components?

anmonteiro10:05:00

@sergiodnila: I wonder which Om version you’re using?

anmonteiro10:05:07

everything seems to be working fine for me

anmonteiro10:05:50

@sergiodnila: actually managed to reproduce it

sergiodnila10:05:01

@anmonteiro: the same version as the tutorial says "1.0.0-alpha24”

anmonteiro10:05:50

@sergiodnila: I’ve edited the tutorial to use alpha34

anmonteiro10:05:07

and I’ve added one more thing regarding the react-key

anmonteiro10:05:14

should fix the problem

anmonteiro10:05:21

this is a consequence of react15

sergiodnila10:05:12

@anmonteiro: thanks will try it

dimiter11:05:03

@tomjack: my whole idea behind using Subcomponents with their own queries is that I don't want the root to be concerned with sub queries.

iwankaramazow13:05:18

@dimiter: that means your Subcomponents are roots on their own... ???

dimiter13:05:00

I guess you could put it that way. Im not sure that how OM Next is designed though. Essentially, I want to prevent the main root from re-rendering on any small state change not concerning it.

dimiter13:05:17

Let say I have a Notification Widget mounted somewhere under the root, I want it to be able to make its own queries without relying on the root to pass through the props.

iwankaramazow14:05:59

That's not going to work 🙈

iwankaramazow14:05:22

unless you mount multiple roots...

francoiswirion14:05:51

Let's say I want to refresh the app (from root) every couple of seconds as time progresses. To schedule an update, do I have to go through transact!? So just transact! some '[(app/refresh)] query? Or is there a way we should use without making a mutate query?

iwankaramazow14:05:12

Yes, transact! is the only way to update the state, you answered your own question

dimiter15:05:34

Thanks @iwankaramazow that clears things up quite a bit. I was just a little confused since my examples were getting the data. Just not in the right order.

anmonteiro16:05:10

@francoiswirion: there's force-root-render!

francoiswirion16:05:07

@anmonteiro: Oh, thanks, I've never heard of that function

kauko17:05:12

I'm trying to work through the tutorial for untangled, and at this point it's probably 100% similar to just pure om. Could anyone help me with the queries and state exercise? Drop me a PM simple_smile

kauko18:05:17

Nevermind, I got some help simple_smile

abtv21:05:00

Hello. I started to use Om.Next and can't understand how to update data in inner component. I receive the following error: {:message "No queries exist for component path (om-next-starter-kit.core/OuterView om-next-starter-kit.core/InnerView)", :data {:type :om.next/no-queries}}. There is the code:

abtv21:05:37

I don't know what query should be in OuterView component if I just want to update data in InnerComponent (something like om/get-query)

abtv22:05:49

hm, I'm looking on om/computed, maybe this is the solution...

tomjack23:05:22

OuterView query should be something like [{:inner (om/get-query InnerView)}], and you should pass (:inner props) to inner-view

tomjack23:05:24

the root query should express the entire query tree with get-query on subcomponents (and so should they), and with the defaults the app state graph is supposed to be shaped according to the component query structure. in your specific example you could just turn InnerView into a function (maybe using om/computed to pass callbacks in) and the app state would not need to mention it

tomjack23:05:37

maybe if you make it a function, there is no point to om/computed, because the function can't go using unknown subcomponents anyway -- it would just return html