Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion apps/wistia-videos/src/functions/getVideos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,12 @@ export const fetchVideos = async (
);
// Flatten array of arrays
const videos = mappedProjects.flat(1);
return videos;
// Deduplicate by video ID — pagination fetches can return the same video twice
// when Wistia ignores the page param and returns all medias on every page
const seen = new Set<number>();
return videos.filter((v) => {
if (seen.has(v.id)) return false;
seen.add(v.id);
return true;
});
};
Loading