fix(wistia-videos): deduplicate videos to prevent double entries in field [ES-372]#11024
Merged
Harika Kondur (harikakondur) merged 1 commit intoJun 12, 2026
Merged
Conversation
…ield [ES-372] When a Wistia account has more than 500 videos in a single project, the pagination logic fetches additional pages — but Wistia ignores the page param on the project endpoint and returns all medias on every page. This causes each video to appear twice in the data array, and since setNewValues filters by ID, both copies get written to the field value. Fix by deduplicating by video ID after flattening the results in fetchVideos. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot started reviewing on behalf of
Harika Kondur (harikakondur)
June 12, 2026 18:47
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an issue in the Wistia Videos app where selecting videos could write duplicate entries into the wistiaVideo JSON field due to Wistia’s project endpoint returning the full media list even when paginated requests are made.
Changes:
- Deduplicates the flattened
fetchVideosresult set byvideo.idbefore returning it to the UI.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ryunsong-contentful
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wistiaVideoJSON field was adding 2 copies of each selected video to the field value,Root cause
A Wistia account with more than 500 videos in a single project (
VIDEOS_PER_PAGE = 500) triggers the pagination logic infetchVideos. It fetches an additional page (projects/{id}.json?page=2), but Wistia's project endpoint ignores thepageparameter and returns all medias on every request.This means
dataends up with every video duplicated. WhensetNewValuesfiltersdataby selected IDs, both copies of each selected video pass the filter and get written to the field.Fix
Deduplicate videos by
idafter flattening results infetchVideos, before returning to the component.