react · Easy · controlled state
A controlled React table receives a new set of selectable rows after filtering. The local reducer keeps removed IDs and emits duplicate change events.
Task
Reduce replace, toggle and select-all events into a valid ordered selection and a minimal list of emitted snapshots.
Contract
Input is {availableIds,initialSelected,events}. replace carries availableIds; toggle carries id; all carries checked. Return {selected,emissions}.
Acceptance criteria
- Keep selection in available-ID order.
- Ignore toggles for unavailable IDs.
- Emit only when the selected IDs actually change.
- Prune selection after replace.
Constraints
- Do not mutate caller-owned input.
- Keep the supplied framework adapter and public contract unchanged.
- Add candidate tests for at least one boundary not covered by the public cases.
Editable files
src/repair.js— Task-specific state or service boundarytests/candidate.test.js— Candidate-authored regression