om

Please ask the channel first, not @dnolen directly!
slipset 2017-09-04T10:37:59.000058Z

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

slipset 2017-09-04T10:38:01.000332Z

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

slipset 2017-09-04T10:38:25.000280Z

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

slipset 2017-09-04T10:39:08.000053Z

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

slipset 2017-09-04T10:39:11.000039Z

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

rarous 2017-09-05T15:15:59.000198Z

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

slipset 2017-09-04T10:39:41.000250Z

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

slipset 2017-09-04T10:40:10.000186Z

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.

slipset 2017-09-04T12:19:44.000090Z

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

slipset 2017-09-04T12:21:02.000394Z

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