Fork me on GitHub
#om
<
2016-10-12
>
jasonjckn00:10:58

upgraded 馃檪

alex-glv10:10:30

Hey, could anyone suggest what鈥檚 the correct way to use :query-root to denote what鈥檚 to send to the server? e.g, is it right in read

(let [updated (assoc ast :query-root true))
    {target updated})
Can I assume this will be the root query to be sent over, if only one key did that for its ast?

anmonteiro10:10:35

@alex-glv yes, given you use process-roots on the send function

alex-glv10:10:33

Ah, yeah. I am still struggling a bit with the terms and parsing in om.next, not sure if the wording makes good sense. I am trying to work on learning from grounds up, ast and parsing, sending queries etc..

anmonteiro10:10:55

I鈥檓 afraid I don鈥檛 understand your issue

anmonteiro10:10:00

Happy to talk it through here

alex-glv10:10:14

I鈥檒l close it. I changed a lot and trying to learn om by re-implementing parts of compassus and reading other resources. I realised I don鈥檛 how it works yet.

rastandy10:10:32

hello everyone

rastandy11:10:04

I鈥檓 currently struggling with text inputs in om.next

rastandy11:10:42

does anyone implemented a generic text input component which don鈥檛 loose focus?

rastandy11:10:11

sorry for my poor english

mitchelkuijpers11:10:58

@peeja we just create a state atom serverside with a db inside it? And then after mutations update the db with a db-after

peeja13:10:56

@alex-glv It sounds like you're thinking about the data backwards. You don't want to pass the data from your route into your components, you want to query for it from your components.

peeja13:10:41

For instance, on CircleCI, here's a page that's querying for the organization that was selected by the URL: https://github.com/circleci/frontend/blob/master/src-cljs/frontend/components/pages/projects.cljs#L145

anmonteiro13:10:51

@peeja are you using Compassus in production?

peeja13:10:04

As of yesterday 馃檪

anmonteiro13:10:40

awesome, great to hear!

levitanong16:10:06

@rastandy Can you tell us in more detail what about text inputs you are struggling with? When you ask about whether someone has implemented a generic text input that doesn鈥檛 lose focus, do you mean a text input that is always focused, and cannot be unfocused?

rastandy16:10:55

@levitanong yeah, sorry for the ambiguous question

rastandy16:10:13

@levitanong I mean a text input component which allows to call an om.next transaction in its onChange event, and don鈥檛 loose focus even when the transaction causes a call to its own render function

levitanong16:10:13

@rastandy Hmm.. I don鈥檛 recall ever having that problem. Could you paste some sample code?

rastandy17:10:47

@levitanong let me try to isolate the problem and send you a self contained example

levitanong17:10:05

@rastandy that would be great!

rastandy17:10:47

@levitanong I can鈥檛 make it on time

rastandy17:10:56

@levitanong but I鈥檒l prepare one for tomorrow

rastandy17:10:08

@levitanong thank you for your help for now 馃檪

levitanong17:10:56

@rastandy: sure thing :) just ping me.

dnolen18:10:51

@anmonteiro merged those outstanding PRs from yesterday

anmonteiro18:10:10

thanks for the heads up

jasonjckn18:10:25

Is there a way to trigger re-render of given read keys, in the clientside mutation implementation?

jasonjckn18:10:18

e.g. instead of (transact! this [(choose-tab) :key-on-root]) have it so it's just (transact! this [(choose-tab)]) and :key-on-root is specified inside 'choose-tab mutation

jasonjckn19:10:37

if I add to render queue immediately after calling transact! , and renders guaranteed to happen after the all the client-side mutations have been processed, that were just specified prior in the transact! ?

jasonjckn19:10:13

e.g.

(transact! this [(choose-tab)])
(omp/queue! reconciler [:key-on-root])

arohner19:10:50

I鈥檓 hitting two, I suspect related react warnings: Expected props argument to be a plain object. Properties defined in its prototype chain will be ignored. and Unknown props 鈥榤eta', 鈥榗nt', 鈥榓rr', 鈥榑_hash', 鈥榗ljs$lang$protocol_mask$partition0$', 鈥榗ljs$lang$protocol_mask$partition1$' on <div> tag. Remove these props from the element.. I鈥檓 calling (om.dom/div (clj->js {}) 鈥), but the clj->js source makes me think this should work without error.

anmonteiro19:10:40

@arohner could you somehow have forgotten to use clj->js somewhere?

anmonteiro19:10:06

that looks just like the attributes of a persistent data structure

arohner19:10:19

@anmonteiro yeah it鈥檚 possible, I just don鈥檛 see where 馃檪

anmonteiro19:10:37

I would even risk saying that鈥檚 what you鈥檙e doing for sure 馃檪

herbm19:10:05

Better to ask om-next ? here or in #om-next which has far fewer members -- #anmonteiro tells me om-next is in active development, the 2 are quite different, therefor beginner should start with om-next probably -- best resources to understand om-next quickly? I am now up and running with React Native on Android and wish to write primarily for the Android platform initially with option to re-use (much) on web or iOS or even desktop...

dnolen19:10:53

@herbm there鈥檚 a bunch of stuff on the wiki you should read through, but you should also ask questions here for anything that you don鈥檛 understand

dnolen19:10:46

there鈥檚 a bit of learning curve if you鈥檙e coming from typical front-end dev, we incorporate some ideas from GraphQL/Relay as well as Falcor - neither which are that well known / understood yet

arohner20:10:16

cljs.user> (om.dom/div #js {} "foo")
#object[TypeError TypeError: Cannot convert a Symbol value to a string]
TypeError: Cannot convert a Symbol value to a string
    at Array.join (native)
    at Function.cljs.core.str.cljs$core$IFn$_invoke$arity$1 ()
    at Object.cljs$core$str [as str] ()
    at Object.cljs$core$pr_writer_impl [as pr_writer_impl] ()
    at cljs$core$pr_writer ()
    at 
    at Object.cljs$core$pr_sequential_writer [as pr_sequential_writer] ()
    at cljs$core$print_map ()
    at Object.cljs$core$pr_writer_impl [as pr_writer_impl] ()
    at Object.cljs$core$pr_writer [as pr_writer] ()

arohner20:10:20

Is that known/expected?

anmonteiro20:10:53

yeah, that鈥檚 just the printing

anmonteiro20:10:01

use js/console.log to see the stuff in the console

arohner20:10:43

so, fun times. I am calling clj->js, from a macro, and it鈥檚 not ending up in the .js

arohner20:10:59

I don鈥檛 know why yet though

arohner20:10:13

got it. macros + reader conditionals are hard. fun new question in #clojurescript

alex-glv20:10:08

Trying to wrap my head around readers. - What am I allowed to return? :value is just going to stop parsing and bubble up the reads. - I can return {target ast} (potentially modified). If I return an AST of one of the children, how is going to affect the merge later? - Can I return another query? If yes, can I return (with-meta query {:query-root true}), will this query be sent over to the remote (given I do process-roots in send) - Will every key in the query hit the reader that has this key as dispatch value unless parent returned :value, then it won't? Appreciate if anyone can chime in on these questions!

ag21:10:53

So if I have data something like this:

{:colors  {:colors/list  [{:color-id 0
                           :name "red"
                           :details  [{:id 0 :description "Red. Cras placerat accumsan nulla"}
                                     {:id 1 :description "Red. Donec vitae dolor"}
                                     {:id 2 :description "Red. Nullam rutrum"}]}
                          {:color-id 1 :name "orange"
                           :details  [{:id 0 :description "Orange. Cras placerat accumsan nulla"}
                                      {:id 1 :description "Orange. Donec vitae dolor"}
                                      {:id 2 :description "Orange. Nullam rutrum"}]}
                          ,,,]}}
What would be the correct (parametrised) query to retrieve details for a given color-id

ag23:10:51

why this

(let [st (om/get-app-state reconciler)]
  (om/db->tree [({:colors [{:colors/list [:color-id :details]}]} {:color-id 1})] <@U07E9BBBN> <@U07E9BBBN>))
not working?

ag23:10:11

why is it so tricky鈥 this does not return anything (om/db->tree [{:colors [({:colors/list [:color-id]} {:color-id 1})]}] <@U07E9BBBN> <@U07E9BBBN>) but if I quoted it returns all items. (?)