A support ticket queue lists open tickets, each with its own internal note input the agent can type into. Resolving a ticket removes it from the list and should leave every other ticket's note exactly as it was.
Type a note on one ticket, then resolve a different ticket above it in the list. The note you typed reappears on the wrong ticket, the one that took the resolved ticket's place in the list.
The note for each row is looked up by its position in the list - does that position always point to the same ticket after the list changes?
The note for each row is looked up by its position in the list - does that position always point to the same ticket after the list changes?
Why this fixes it
notes was tracked as an array parallel to tickets, looked up purely by array position (notes[index]). handleResolve correctly removed the resolved ticket from tickets by filtering, but never touched notes, so the notes array kept its original length and original positional mapping. After a ticket left the list, every remaining ticket's position shifted up by one, but its note lookup still pointed at the old position, so each remaining ticket displayed the note that had belonged to the ticket below it. Replacing the position-indexed array with an object keyed by ticket.id, and looking notes up by notes[ticket.id] instead of notes[index], ties each note permanently to the ticket it belongs to regardless of where that ticket sits in the list after a deletion.