Skip to content

VideoPress admin: TypeError in @base-ui/react useMergedRefs on video delete/upload (regression from #48909) #49230

@obenland

Description

@obenland

Summary

Deleting or uploading a video in the VideoPress admin page (projects/packages/videopress/src/client/admin/) throws an uncaught TypeError from inside @base-ui/react@1.4.1's useMergedRefs / useRenderElement path. The React tree crashes and the admin becomes unresponsive.

Tracking: #48160 — Jetpack UI Modernization.

Reproduction

  1. Connect Jetpack on a fresh site (free tier — no VideoPress purchase, so the UpgradeTrigger renders).
  2. Open the VideoPress admin (wp-admin/admin.php?page=jetpack-videopress).
  3. Upload a video, or delete an existing one.
  4. React tree crashes; admin becomes unresponsive.

Reproduced on profoundly-select.jurassic.ninja, current trunk.

Stack — delete

TypeError: Cannot read properties of null (reading 'refs')
  at didChange (@base-ui/utils/useMergedRefs.js)
  at useMergedRefs
  at useRenderElementProps (@base-ui/react/internals/useRenderElement.js)
  at <UpgradeTrigger> in projects/packages/videopress/src/client/admin/components/admin-page/index.tsx (lines 248–256 on trunk)

Stack — upload (likely same root cause, different arm)

TypeError: Cannot read properties of undefined (reading 'length')
  at useEffect callback in @base-ui/react internals
  at mf (react-dom commit)

Bisect / suspected commit

27bf601935Componentry: migrate ContextualUpgradeTrigger to @wordpress/ui *Notice (*#48909).

Before this commit, UpgradeTrigger used ContextualUpgradeTrigger from @automattic/jetpack-components and did not pull @wordpress/ui (and transitively @base-ui/react) into the admin bundle. After it, every re-render of <UpgradeTrigger> runs through base-ui's ref-merge path. The crash reliably fires when hasVideos / hasUsedVideo flips on delete/upload.

Confirmation

Locally replaced the <Notice.Root> tree in admin-page/index.tsx with a plain <div> / <button> and rebuilt the videopress package. Both crashes disappeared.

Suggested fix options

  • Revert 27bf601935's changes to projects/packages/videopress/src/client/admin/components/admin-page/index.tsx (keep the rest of the migration if other consumers in that commit are clean).
  • Or replace just that UpgradeTrigger Notice usage with ContextualUpgradeTrigger until the upstream base-ui behavior is resolved.

Environment

Metadata

Metadata

Assignees

Labels

BugWhen a feature is broken and / or not performing as intended[Plugin] VideoPressA standalone plugin to add high-quality VideoPress videos to your site.

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