Skip to content

Widget SDK ships ~3.5 MB of admin-React chunks to public visitors + throws React #418 #4

@BunsDev

Description

@BunsDev

Found this while running Lighthouse against the OpenCoven landing (opencoven.ai). Two related issues, same source: the widget SDK at https://feedback.opencoven.ai/api/widget/sdk.js.

What I'm seeing

When a logged-out public visitor loads any page that embeds the widget, the SDK eagerly fetches admin-side chunks they have no use for:

Chunk Size Unused on public widget
components-admin-changelog-BnxEblpI.js 1,511,722 B (≈1.5 MB) 761,985 B unused
components-admin-settings-xOzDn54o.js 735,534 B 636,133 B
route-admin-ChuhoD_k.js 412,301 B 306,813 B
components-admin-help-center-yBJnR46P.js 304,515 B 283,729 B
components-admin-feedback-33AsM9vA.js 322,279 B 271,349 B
components-admin-admin-sidebar-CU85Ev-Z.js 378,557 B 265,721 B
LightBulbIcon-CJ1QkMaK.js 125,063 B 89,691 B
components-settings-CluLjXTx.js 77,248 B 66,552 B

That's roughly 3.5 MB of admin-panel JS downloaded on every public page view. None of it is reachable as a logged-out visitor.

Alongside the bundle weight, the widget throws a minified React error #418 on boot:

Error: Minified React error #418; visit https://react.dev/errors/418?args[]=HTML&args[]=
   at Gi (https://feedback.opencoven.ai/...)

React 418 is "Hydration failed because the initial UI does not match what was rendered on the server." Lighthouse picks this up as a console exception and drops Best Practices from 100 → 96.

Measured impact on opencoven.ai

Metric With widget loaded Widget gated on user click
Mobile Performance 87 97
Mobile Best Practices 96 100
Mobile TBT 290 ms 0 ms
Mobile LCP 1.8 s 1.7 s

We worked around this on the landing side by gating the widget loader behind an explicit "Feedback" button (OpenCoven/coven-landing#15) so the SDK only loads after a user clicks it. That keeps Lighthouse runs clean and stops the admin chunks from blocking real visitors. But it shouldn't take a hack on every embedder to avoid this.

What I think the fix looks like

  1. Code-split admin from widget. The public widget should only need: a launcher button, a feedback form, network/auth client. Admin views (changelog editor, settings, help-center editor, admin sidebar) belong in a separate entry that admin pages load and the public widget never imports.
  2. Investigate the React #418. Likely a hydration mismatch between the SSR'd shell and what the client expects to mount when embedded inside a third-party page — could be related to <html lang> differing, theme/colorscheme detection, or Date.now() / random values in the initial render.

Happy to share the full Lighthouse JSON or pa11y output if useful. Also happy to test against a candidate fix.

— from OpenCoven/coven-landing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions