Training Grounds
Resolving a Ticket Scrambles the Other NotesBlue Belt
+25 Ki
Description

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.

Anomaly

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.

Constraint
Do not store note state inside TicketRow - keep it controlled from the parent
Do not change TicketRow's props (label, note, onNoteChange)
Hint

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?

Consult the SenseiOnly for those truly stuck · Flip to reveal

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?

Loading editor…
Correct Solution
Loading...

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.

Expected OutputGoal State
Your OutputLive