Set for deduplication, and where it quietly fails

[...new Set(values)] is the shortest deduplication in the language and it compares by identity, so it does nothing at all for a list of objects that happen to be equal.

[...new Set([1, 1, 2])];                    // [1, 2]

[...new Set([{id: 1}, {id: 1}])].length;    // 2 — different objects

// deduplicate by a key instead
[...new Map(rows.map(r => [r.id, r])).values()];

The Map form is the general answer: key by whatever makes two rows the same, and the later one wins. Set uses SameValueZero, which differs from === in exactly one place — NaN equals itself — so a list of numbers with a NaN in it deduplicates the way you would want and the way indexOf would not.