Skip to content

fix(sseMultiplexer): add BroadcastChannel feature guard to prevent crash in unsupported browsers #71

Description

@tmdeveloper007

Summary of What Needs to be Done

Add a feature-detect guard for BroadcastChannel in src/utils/sseMultiplexer.js. The constructor currently checks typeof window !== undefined before instantiating BroadcastChannel, but BroadcastChannel itself is absent in Safari < 15.4, Internet Explorer, and older Edge. When a browser has window but lacks BroadcastChannel, the constructor throws ReferenceError, crashing the entire module at import time.

Changes

Wrap the new BroadcastChannel(...) call inside typeof BroadcastChannel !== undefined. This allows the SSE multiplexer to gracefully fall back to the localStorage-based election path on unsupported browsers.

Impact

Severity: High — Production crash in Safari < 15.4, IE, and older Edge. Users on affected browsers get a blank page or runtime error on first load. This is a module initialization failure.

Please assign this task to me.

Labels: gssoc:approved, level:beginner, type:bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    gssoc:approvedApproved for GSSoC contributionlevel:beginnerSmall, low-risk change (≤3 files, ≤50 lines)type:bugSomething is broken or incorrect

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions