Fork me on GitHub
#om
<
2016-03-12
>
whythat01:03:10

Hi everyone! I don't know if this is the right place to ask, by why is that when I have app state as deeply nested (atom {... :ch [<n1> <n2> <n3>]...}) and do (om/transact! data [... :ch] #(conj % <n4>), then (get-in data [... :ch 2]) returns cursor to <n3> but (get-in data [... :ch 3]) returns nil instead of <n4>? Have been trying to fix this for 3 hours.

rauh07:03:22

@whythat: What you're passing in to om/transact looks like you should be passing to swap! inside a mutation handler (Missing an update-in before [... :ch].

whythat09:03:36

@rauh: OK, I'll try that. Thanks.

drakezhard10:03:00

Hi I'm having a problem with a Om Next game of tic-tac-toe. I have two component instances that call a mutation for the next computer move. When the computer plays against another computer, the game stops in the third move. The thing is I kind of monkey patched it, when I redefine the component and the component factoy after add-root! the application works as expected.

drakezhard10:03:21

(defn init [] (om/add-root! reconciler TicTacToe (gdom/getElement "app")) (defui Player static om/Ident ...Elided... static om/IQuery ...Elided... Object (render [this] (let [{:keys [idx name type active? winner piece] :as props} (om/props this)] (if (and active? (= type :computer)) (do (om/transact! this `[(tic-tac-toe/computer-move ~props) :active-player :players :board]) (player-view winner name type this props)) (player-view winner name type this props))))) (def player (om/factory Player {:keyfn :idx})))

symfrog19:03:24

Are the query parameters of nested queries available in parser read functions? I have the following root query:

[:app/route {:route/data [({:person [:name {:address [:street]}]} {:id person.app/?id})]}]
The query value of :route/data is generated by calling om/get-query on a sub-component which has a parameterized query. As expected the reader function is invoked with a key of :route/data, but the values of the nested query's params is not passed in any of the arguments to the reader function which means the response can not be appropriately built. There may also be entirely different ways to approach this?

symfrog20:03:54

The sub-component's query was syntax-quoted, using unquote-quote on the parameters in the query solved it