Fork me on GitHub
#om
<
2017-09-04
>
slipset10:09:59

So, using om-classic, I find myself writing:

slipset10:09:01

(dom/td nil (inc (aget (aget owner "props") "__om_index")))

slipset10:09:25

in a component which is built with om/build-all

slipset10:09:08

RTFS’ing I see that om/build-all does

slipset10:09:11

(map (fn [x i]
          (build f x (assoc m ::index i)))
     xs (range))

rarous15:09:59

there is also standard library function map-indexed so you don’t have to use range

slipset10:09:41

So I’d expect to find ::index in the opts map of my function, but the opts map seems to be nil

slipset10:09:10

What I’m after is a way to easily get a hold of the index of the thing I’m building in om/build-all.

slipset12:09:44

So, I guess what I’m looking for is (::index m) being passed in opts in

slipset12:09:02

so changing (let [ret (f cursor' this opts)] ...) to (let [ret (f cursor' this (assoc opts ::index (::index m)))]...)