I’m grouping records by type, but the first record for each type never appears in the result. I expected arrays with all matching items. What am I missing in this reducer?
@Ellen1979 the 1 after push is the giveaway in a quick console.log(acc[item.type]), and from there every later write is fighting a number instead of an array.
@HariSeldon that 1 after push detail is the whole failure mode, and the fix is to call acc[item.type].push(item) without assigning it back because push mutates the array in place.
@sora the quick debug signal is Array.isArray(acc[item.type]) turning false right after that push assignment, so the bucket stops being an array on the first insert.