Skip to content

Fix support for reusing responsive video src#75

Merged
weotch merged 7 commits intomainfrom
fix-support-for-reusing-responsive-video-src
Feb 4, 2026
Merged

Fix support for reusing responsive video src#75
weotch merged 7 commits intomainfrom
fix-support-for-reusing-responsive-video-src

Conversation

@weotch
Copy link
Member

@weotch weotch commented Feb 4, 2026

No description provided.

@weotch weotch requested a review from Copilot February 4, 2026 00:40
@codesandbox
Copy link

codesandbox bot commented Feb 4, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where multiple media queries that reference the same video URL would fail because the old implementation used URLs as object keys, causing collisions when the same URL was used for different media queries. The fix restructures the data to use media queries as keys and URLs as values in the server component, and introduces an indexed intermediary structure in the client component to avoid similar collisions.

Changes:

  • Modified LazyVideoServer.tsx to build mediaSrcs with media queries as keys instead of URLs, preventing key collisions when the same URL is used for different media queries
  • Updated LazyVideoClient.tsx to use an indexed query structure to avoid issues with duplicate URLs, and refactored getFirstMatch to work with the new structure
  • Added comprehensive tests to verify the fix works correctly for both the base case and the Contentful integration

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
packages/react/src/LazyVideo/LazyVideoServer.tsx Refactored media source object construction to use media queries as keys and URLs as values, eliminating the key collision issue
packages/react/src/LazyVideo/LazyVideoClient.tsx Added indexed query transformation to handle duplicate URLs correctly and updated the matching logic to work with the new structure
packages/react/cypress/component/LazyVideo.cy.tsx Added test case to verify that the same video asset can be used with different media queries
packages/contentful/cypress/component/ContentfulVisual.cy.tsx Added test to verify fallback behavior when portrait video is not set

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

weotch and others added 5 commits February 3, 2026 16:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
….com:BKWLD/next-visual into fix-support-for-reusing-responsive-video-src
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@weotch weotch merged commit 97ed28d into main Feb 4, 2026
10 checks passed
@weotch weotch deleted the fix-support-for-reusing-responsive-video-src branch February 4, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant