Fork me on GitHub
#om
<
2016-02-23
>
reedho00:02:06

@anmonteiro: thank you, definetely helping me just in time 馃憤

drcode02:02:04

@anmonteiro: Yup, I was jsut about to clean up my routing logic- Thanks for the post!

jimmy03:02:54

@anmonteiro: thanks for great post simple_smile

hayden05:02:27

Fairly new to Clojurescript/Om (next), is there any good info out there about working with React components in Om next?

hayden05:02:49

@tawus: I鈥檒l take a look, thanks!

jimmy06:02:02

does anyone experience the problem that when we use core async mult, and tap channel in componentDidMount, it works perfectly fine but if the app is being loaded by figwheel, it's being called multiple times until the browser crashes.

marianoguerra08:02:22

@nxqd: no idea, but maybe this helps? (defui ^:once MyComponent)

jimmy08:02:21

@marianoguerra: thanks, will try it out

danielstockton09:02:02

are there are pros/cons to the different routing approaches that people are aware of?

sander10:02:15

@danielstockton: I found the union queries approach yields very long queries that are harder to read when debugging

danielstockton10:02:30

interesting, that's the approach i naturally went for

sander10:02:18

depends on the use case, e.g. how many entries the union map would get

rauh11:02:58

I'm trying to do a remote read but my send function never gets invoked. Also NB: :target is always nil in my read functions. Any ideas?

marianoguerra11:02:47

@rauh: are you using the default remote name? if so, are you adding :remote true or :remote ast to the mutate to make it send?

marianoguerra11:02:58

s/mutate/read/

marianoguerra11:02:18

if you aren't using the default remote name then change :remote for the name of your remote

rauh11:02:10

@marianoguerra: Yes I tried both actually. Also tried the default remote name or specifying my own ones. :send never gets called 馃槥

marianoguerra11:02:33

can you share some code?

marianoguerra11:02:43

of the read when you create the reconciler and the send function?

rauh11:02:48

@marianoguerra: It's actually all the vanilla code samples from om.next example. I'll try to isolate it further. I thought maybe this was a common problem.

marianoguerra11:02:28

@rauh: you can try this example that uses remotes and is quite simple and tell me if it works https://github.com/marianoguerra-atik/tudu-v1

rauh11:02:41

That project works. I'm going to do some more debugging.

rauh11:02:08

So the remote read works if I return it at the root query (I call the parser recursivley) but not when returning it in one of the other key-reads. I thought it was as easy as (assoc ast :query-root true) 馃槥

rauh11:02:37

I see, I've been digging there. I was hoping it'd be easier.

rauh11:02:08

@anmonteiro: In his code, he switches at the very top depending on target. But why is mine always nil? The docs say it should be called for each remote, no?

rauh11:02:56

Oh ok, again it isn't in my top level read before I recurse. simple_smile

anmonteiro12:02:40

You answered your question :)

anmonteiro12:02:14

The point is that this not an Om related thing at all... It's just how recursion works and people should be aware of that

bago13:02:15

Any suggestion on how to integrate a plain React component in Om? A guide or something would be much appreciated. I鈥檓 trying to use this https://github.com/RubaXa/Sortable (if you have an alternative for a Sortable list in Om please let me know) thanks

anmonteiro13:02:31

also, integrating a plain React component in Om is no harder than (js/React.createElement your-react-componentt #js {:its :props})

bago13:02:41

thanks @anmonteiro i鈥檓 looking for a sortable that works on mobile too and the one you suggested looks like use draggable instead of touch events. i鈥檒l check it out better anyway.

jannis13:02:42

@iacopo: I'll happily take a PR that adds touch DND simple_smile

jannis13:02:06

I haven't invested time into implementing it yet but it would make a lot of sense

taylor.sando13:02:10

(defn -input [opts & children](apply js/React.createElement js/ReactBootstrap.Input opts children))
Example of using react bootstrap input

bago13:02:05

@jannis: i would love to have the time to build it..

jannis13:02:04

@iacopo: Ain't time always the problem 馃槈

grzm16:02:43

I know slack is the new hotness and all, but I find it really disheartening that history is so limited. Trying to go back to find something from the 16th (a week ago), and it's no longer there 馃槙

grzm16:02:35

From what I can tell, not even pinned items are available if they're beyond the history cut-off.

grzm16:02:03

oh, that's nice. thanks!

grzm16:02:14

Are there some examples out there of custom reconciler merge functions? I don't see any on the wiki or the tony.kay's om-tutorial

iwankaramazow17:02:28

@grzm: I used this one for a while (defn custom-merge-tree [a b] (if (map? a) (merge-with into a b) b))

iwankaramazow17:02:14

Although that was a couple of Om Next alphas back

iwankaramazow17:02:18

For some strange reason it doesn't work anymore 馃槀

iwankaramazow17:02:24

might be my code though

grzm18:02:19

thanks! I'll start playing around with it.

hueyp18:02:38

has anyone done any kind of falcor-router type dispatcher experiment for om.next?

hueyp18:02:30

I鈥檓 thinking it might be pretty cool and should fit into the parser interface fine

anmonteiro19:02:27

for interested folks, there's a talk on React.js conf right now that'll mention Om Next

grzm19:02:18

Where does the novelty value come from that's passed to the merge function?

grzm19:02:16

In particular, when values come back in via a remote mutation call.

thiagofm22:02:34

I still keep getting "Encountered two children with the same key" 馃槥 I've tried providing a Ident but this didn't fix my problem and I also saw in the docs that this doesn't aplly if I'm using datascript(which is the case)

futuro22:02:31

have you supplied a {:keyfn <key function to use>} for the factory?

thiagofm22:02:41

(def tab-link-comp (om/factory TabLink {:keyfn :name})) yes

futuro22:02:00

Are you certain :name is unique?

thiagofm22:02:17

I don't understand what "Can optionally supply :keyfn - this should produce the React key property from the component props" in the docs means

thiagofm22:02:40

What component props? What is considered a component prop?

thiagofm22:02:06

I have this in my component: Object (render [this] (let [{:keys [name]} (om/get-computed this)]

hueyp22:02:15

the map you pass to the factory fn 鈥 (user {:name 鈥淗uey鈥潁)

thiagofm22:02:53

I call it like... (tab-link-comp (om/computed (om/props this) {:name "Store"})) (tab-link-comp (om/computed (om/props this) {:name "Skilltree"})))

thiagofm22:02:59

And for the case above I get the error

hueyp22:02:16

I think for computed your :keyfn would need to pull them out of computed

hueyp22:02:32

like :keyfn (fn [props] (-> props om/get-computed :name)) maybe?

thiagofm22:02:41

Can you give an example? Oh okay

hueyp22:02:54

I鈥檓 not 100% sure, I鈥檝e never done anything other than a key off of props

thiagofm22:02:58

So I can pass a function to keyfn

hueyp22:02:10

I assume! again, just passed keywords so far simple_smile

futuro22:02:31

yeah, I've passed in the name in the normal props, not the computed props.

jr22:02:32

is keyfn producing nil?

futuro22:02:30

In fact, why are you adding a static value to your computed props?

futuro22:02:22

why not use (tab-link-comp (merge {:name "Store"} (om/props this))?

thiagofm22:02:28

@hueyp You sir, have just fixed my problem

hueyp22:02:48

@futuro: props should only be things from the query

futuro22:02:58

@hueyp: very interesting

hueyp22:02:08

om.next can set props directly to the component which will I think potentially remove non-query props

thiagofm22:02:10

@futuro Didn't know I could do this... I thought props were supposed to come from hmm, querying, and anything else I should use computed props

futuro22:02:11

that is good to know

futuro22:02:31

yeah, I guess maybe you are supposed to do that

thiagofm22:02:43

final example: (def tab-link-comp (om/factory TabLink {:keyfn (fn [props] (:name (om/get-computed props)))}))

futuro22:02:52

I'd never seen that before, so good to know

thiagofm22:02:27

No problem, I generally have no idea what I'm doing and I'm happy to know that people can understand my questions haha

futuro22:02:54

Heh, for sure.

cjmurphy23:02:15

When you take a look at the 'default db format' map it has two types of entries. At the moment I'm calling them 'by-id entries' and 'non by-id entries'. The by-id entries are where your data tables are. The 'non by id' are are a vector of Idents, or in some cases just one Ident. Examples:

cjmurphy23:02:26

:session/by-id {1 {:id 1, :app/messages [[:message/by-id 100]]}}

cjmurphy23:02:52

:app/session [:session/by-id 1]

cjmurphy23:02:19

I'm looking for a better way of referring to these two types of entries. Than 'by id entries' or 'non by id entries'.

hueyp23:02:31

[:app/session _] is referred to as a unique-ident in code at places

cjmurphy23:02:13

I've written a small library with a check function that checks if your state is in 'default db format'. So looking to name things (even internal things) a bit better.

cjmurphy23:02:29

That an Ident. There's plenty of use of that name already 馃槈

anmonteiro23:02:57

@cjmurphy: "Om Next tables" might be a good name

cjmurphy23:02:54

Good yes. And the 'non-ids', which are just a vector of Idents normally. Maybe 'refs' - because that's what they are - a list of references.

cjmurphy23:02:03

Thanks. Will look in and rename!

anmonteiro23:02:25

refs are what's in the om next tables..

cjmurphy23:02:03

refs are idents (from your thinking in...)

cjmurphy23:02:37

Non ids are a 'list' of idents.

cjmurphy23:02:48

vector really.

cjmurphy23:02:11

So maybe 'ref-entries'

cjmurphy23:02:06

table and ref map entries. That's the normalized format I think.