I expected this helper to keep only the first user for each id, but I still get duplicates in some cases. What am I misunderstanding about how Set works here, and what would be a clean fix without turning this into O(n^2)?
const users = [
{ id: 1, name: 'A' },
{ id: 2, name: 'B' },
{ id: 1, name: 'A2' }
];
const unique = [...new Set(users)];
console.log(unique);
Yoshiii ![]()