Skip to content

SDK Markdown remounts <video> when a host context changes, so videos restart #6311

Open

Description

@koenvangeert

Summary

A plugin that renders a <video> through the SDK Markdown component loses that video when a host context changes. React unmounts the <video> element and mounts a new one with the same src. The user sees the video flash, resize, and restart from 0:00. I expected the element to stay mounted while content does not change.

Versions and environment

  • bb 0.47.1 (desktop app), macOS 26
  • @get-bb/plugin-sdk 0.6.49
  • Seen in a thread panel plugin (threadPanelAction) of koenvg/bb-plugins bb-plugin-github-insight

Steps to reproduce

  1. In a plugin thread panel, render <Markdown content={'<video src="https://example.com/a.mp4" controls></video>'} /> with a content string that does not change.
  2. Let anything update the host navigation context that Markdown reads (the object with openTab, openUrl, openFilePreview, ...). In my case this happened when the plugin's own data refreshed, about 17 s after the panel opened.
  3. Watch the <video> node with a MutationObserver.

Expected vs actual

Expected: one <video> element for the life of the panel.

Actual (Playwright probe, same content string throughout):
8.1s  mount   #1  <video src=".../681667117-....mp4?jwt=...">
25.0s unmount #1
25.0s mount   #2  same src, same parent <p>
host <a>/<code> removals = 34 at 25.0s
mounts=2 over 30s

Only the <video> node is replaced. Its parent <p> stays. The other closure components (a, code, img) are replaced at the same moment.

Evidence

I hooked __REACT_DEVTOOLS_GLOBAL_HOOK__.onCommitFiberRoot and diffed props and the React Compiler memo cache of the ancestors when the video component type changed:

plugin Markdown wrapper  cache[0]: {openTab,openFileExternally,openFilePreview,openFixedTab,openTerminal,openUrl}  -> new object
plugin Markdown wrapper  cache[8]: linkRouting {onOpenLink,localImage,localFile}  -> new object
markdown preview         props.linkRouting  -> new object
markdown preview         cache[39]: components {a,blockquote,code,h1,...}  -> new object
react-markdown           props.components  -> new object

The chain in the shipped bundle (app/dist/assets, 0.47.1):

  • plugin-frontend-*.js: the SDK Markdown wrapper memoizes linkRouting on the navigation context object. A new context object gives a new linkRouting.
  • markdown-preview-*.js: Pu({...linkRouting, ...}) builds the components map. a, code, img, source, and video are closures inside it. A new linkRouting gives new component functions.
  • React sees a new type for video and remounts it.

For most elements this is invisible. For <video> it drops playback state and reloads the media.

What you ruled out

  • Not a src change. Old and new elements have the same src attribute.
  • Not the plugin re-rendering. Wrapping the caller in React.memo does not help, because the change comes through context.
  • Not a remount of the whole Markdown tree. The parent <p> survives.

Suggested priority and effort (optional)

Medium. Any plugin that shows videos in Markdown is affected. A workaround exists: portal your own <video> into a slot. The fix is probably low effort: keep the components map stable (read routing from a ref or context inside the components instead of closing over it), or at least move video out of the closure.

Checks

  • I reproduced this on the latest release or on main, or I say above that I could not. (0.47.1 desktop release; not checked on main.)
  • I searched open and closed issues for the same problem.
  • If an agent wrote this, the body ends with > AGENT GENERATED and links the thread or report.

AGENT GENERATED. Found while fixing the flicker in bb-plugin-github-insight (local bb thread thr_emjjdfrbra).

Activity

  1. added theissue type on Oct 26, 2026
  2. added
    ui
    plugins
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pluginsui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions