@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 11 lines 432 Bytes
Raw
1 // Offset pagination can return the same token on two pages when the list
2 // shifts between fetches; keep the first occurrence of each id.
3 export const uniqueTokens = <T extends { id?: string | null }>(tokens: ReadonlyArray<T>): T[] => {
4 const seen = new Set<string>();
5 return tokens.filter((token) => {
6 if (!token.id) return true;
7 if (seen.has(token.id)) return false;
8 seen.add(token.id);
9 return true;
10 });
11 };