Skip to content

fix: castable mixin redundant optional chaining#238

Closed
ronald-urbina wants to merge 3 commits intomuxinc:mainfrom
ronald-urbina:fix/castable-mixin-redundant-optional-chaining
Closed

fix: castable mixin redundant optional chaining#238
ronald-urbina wants to merge 3 commits intomuxinc:mainfrom
ronald-urbina:fix/castable-mixin-redundant-optional-chaining

Conversation

@ronald-urbina
Copy link
Copy Markdown
Contributor

@ronald-urbina ronald-urbina commented May 4, 2026

Removed unnecessary ?. optional chaining in the muted, volume,
duration, and currentTime getters of CastableMediaMixin

  • In each case, #castPlayer is already verified truthy by the enclosing
    if condition, so the optional chaining was a no-op

Note

Medium Risk
Switching PeerTubeVideoElement to extend HTMLElement directly can break non-browser/SSR environments that relied on the previous fallback base class. README edits are low risk but reduce documented guidance around required transpilation/browser targets.

Overview
Removes the README’s Browser support guidance about packages shipping as ESNext and relying on consumer transpilation.

Updates PeerTubeVideoElement to extend HTMLElement directly (dropping the prior globalThis.HTMLElement ?? class {} fallback), tightening the assumption that a native DOM environment is present.

Reviewed by Cursor Bugbot for commit 76c6c5a. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

@ronald-urbina is attempting to deploy a commit to the Mux Team on Vercel.

A member of the Team first needs to authorize it.

@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented May 4, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6612e3a. Configure here.

}

class PeerTubeVideoElement extends MediaPlayedRangesMixin(MediaTracksMixin(globalThis.HTMLElement ?? class {})) {
class PeerTubeVideoElement extends MediaPlayedRangesMixin(MediaTracksMixin(HTMLElement)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SSR fallback removed for HTMLElement base class

High Severity

The globalThis.HTMLElement ?? class {} fallback was replaced with a bare HTMLElement reference. Every other element in the codebase (e.g., cloudflare-video-element, spotify-audio-element, tiktok-video-element, twitch-video-element) uses the globalThis.HTMLElement ?? class {} pattern to avoid a ReferenceError in non-browser environments like SSR or Node.js. This change breaks that SSR safety for PeerTubeVideoElement.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6612e3a. Configure here.

@spuppo-mux spuppo-mux self-assigned this May 4, 2026
@ronald-urbina ronald-urbina deleted the fix/castable-mixin-redundant-optional-chaining branch May 4, 2026 17: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.

2 participants