reagent 2025-04-14

I have a problem where a callback seems to be using a stale value of a loop variable, something like:

(for [[i row] (map-indexed vector rows)]
  [:li {:key (:id row)}
    [:span {:on-click #(remove-idx rows i)]} "X"]
    [:span (:id row)]])
When a row n is deleted, the on-click callbacks are not updated for rows i >= n. I’m presuming this is because functions can’t be compared, but now I’m curious what the rules are for when they’re updated.

Should work. Functions can be compared and in this case they will be different for each render.

alright thanks, I’ll try to reproduce the bug if something else was causing it