Skip to content

perf(embed): code-split the embed players and upload tracker - #3004

Open
07rjain wants to merge 1 commit into
CapSoftware:mainfrom
07rjain:split/embed-player-split
Open

07rjain wants to merge 1 commit into
CapSoftware:mainfrom
07rjain:split/embed-player-split

Conversation

@07rjain

@07rjain 07rjain commented Oct 23, 2026 •

Copy link
Copy Markdown

Split out of #2580 (embed player split).

EmbedVideo statically imported both players, the upload progress tracker and a second framer-motion runtime. These now load with next/dynamic, so an embed only downloads the player it uses. Playback behavior is unchanged, and embed-video-playback-chrome.test.ts covers the split.

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with a non-blocking gap in tests for delayed player loading.

Findings

  1. P2 Late loading goes untested ▶
Fix with agent prompt
### Issue 1
apps/web/__tests__/unit/embed-video-playback-chrome.test.ts:201-203
The new `next/dynamic` mock starts every loader immediately, and `beforeAll` waits for all of them before rendering. This skips the loading behavior introduced by this PR, so the tests cannot catch problems when a player arrives after `EmbedVideo` mounts. Keep a loader pending during at least one test, resolve it after rendering, and check that playback events still update the chrome.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR loads the embed players and upload tracker through next/dynamic and switches the embed chrome to motion/react.

  • Embedded videos load only the player and upload tracker they need.

Tests were not run.

Reviews (1) · Last reviewed commit: "perf(embed): code-split the players and ..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

@07rjain is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Comment on lines +201 to +203
beforeAll(async () => {
await Promise.all(dynamicImports);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Late loading goes untested

The new next/dynamic mock starts every loader immediately, and beforeAll waits for all of them before rendering. This skips the loading behavior introduced by this PR, so the tests cannot catch problems when a player arrives after EmbedVideo mounts. Keep a loader pending during at least one test, resolve it after rendering, and check that playback events still update the chrome.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/__tests__/unit/embed-video-playback-chrome.test.ts
Line: 201-203

Comment:
**Late loading goes untested**

The new `next/dynamic` mock starts every loader immediately, and `beforeAll` waits for all of them before rendering. This skips the loading behavior introduced by this PR, so the tests cannot catch problems when a player arrives after `EmbedVideo` mounts. Keep a loader pending during at least one test, resolve it after rendering, and check that playback events still update the chrome.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch has not been deployed

No deployments
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