Repository navigation
Description
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-sdk0.6.49- Seen in a thread panel plugin (
threadPanelAction) of koenvg/bb-pluginsbb-plugin-github-insight
Steps to reproduce
- 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. - Let anything update the host navigation context that
Markdownreads (the object withopenTab,openUrl,openFilePreview, ...). In my case this happened when the plugin's own data refreshed, about 17 s after the panel opened. - Watch the
<video>node with aMutationObserver.
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 SDKMarkdownwrapper memoizeslinkRoutingon the navigation context object. A new context object gives a newlinkRouting.markdown-preview-*.js:Pu({...linkRouting, ...})builds thecomponentsmap.a,code,img,source, andvideoare closures inside it. A newlinkRoutinggives new component functions.- React sees a new type for
videoand remounts it.
For most elements this is invisible. For <video> it drops playback state and reloads the media.
What you ruled out
- Not a
srcchange. Old and new elements have the samesrcattribute. - Not the plugin re-rendering. Wrapping the caller in
React.memodoes 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 onmain.) - I searched open and closed issues for the same problem.
- If an agent wrote this, the body ends with
> AGENT GENERATEDand links the thread or report.
AGENT GENERATED. Found while fixing the flicker in bb-plugin-github-insight (local bb thread
thr_emjjdfrbra).
Activity
Make plugin surfaces prove they use core's path and delete plugin-onl…