diff --git a/hub-client/changelog.md b/hub-client/changelog.md index bb67bc1f4..175e76494 100644 --- a/hub-client/changelog.md +++ b/hub-client/changelog.md @@ -27,6 +27,10 @@ WASM rebuild is needed for a changelog-only edit. - [`546fdd37`](https://github.com/quarto-dev/q2/commits/546fdd37): The sandboxed preview bundle is rebuilt from its current sources — math rendering there is back on KaTeX 0.18.4, which a later bundle rebuild had quietly reverted to 0.18.2, and the preview's service worker no longer caches assets for offline use. +### 2026-09-02 + +- [`ee47e8ec`](https://github.com/quarto-dev/q2/commits/ee47e8ec): Fix `render-components:` custom TSX overrides silently not loading for revealjs presentations. + ### 2026-09-01 - [`a4c3fb9c`](https://github.com/quarto-dev/q2/commits/a4c3fb9c): The experimental branch bar's Merge button now uses the app's standard accent color in both themes, and its branch-name input shows the standard keyboard focus ring. diff --git a/hub-client/src/components/render/ReactRenderer.integration.test.tsx b/hub-client/src/components/render/ReactRenderer.integration.test.tsx index 3c2bf1560..11b0ec0bb 100644 --- a/hub-client/src/components/render/ReactRenderer.integration.test.tsx +++ b/hub-client/src/components/render/ReactRenderer.integration.test.tsx @@ -300,6 +300,35 @@ describe('ReactRenderer render-components gate (Plan 2A item 13)', () => { }); }); + it('extracts customComponentsCode for revealjs format', () => { + // revealjs renders through the same Q2PreviewIframe/dispatcher tree as + // q2-preview (see ReactRenderer format routing describe block above), + // so render-components: must apply there too. The gate at the top of + // customComponentsCode's useMemo previously only allowed + // 'q2-debug' | 'q2-preview', silently skipping revealjs documents even + // though revealjs converged onto this same tree (bd-vwp4y5ku) — that + // convergence just never extended to this particular gate. + const fileContents = new Map([ + ['elliot/simple.tsx', 'export const Para = () => null;'], + ]); + + render( + {}} + setAst={() => {}} + format="revealjs" + />, + ); + + expect(lastCapturedPreviewCode()).toEqual({ + '/elliot/simple.tsx': 'JS:export const Para = () => null;', + }); + }); + it('q2-debug behavior unchanged (regression baseline)', () => { const fileContents = new Map([ ['elliot/simple.tsx', 'export const Para = () => null;'], diff --git a/hub-client/src/components/render/ReactRenderer.tsx b/hub-client/src/components/render/ReactRenderer.tsx index 9732acf05..9c15bd825 100644 --- a/hub-client/src/components/render/ReactRenderer.tsx +++ b/hub-client/src/components/render/ReactRenderer.tsx @@ -198,12 +198,17 @@ function ReactRenderer({ ); // Extract component paths - only recompute when the list of paths - // changes. The gate covers both q2-debug and q2-preview because both - // load user TSX overrides via the iframe's + // changes. The gate covers q2-debug, q2-preview, and revealjs because + // all three load user TSX overrides via the iframe's // `LOAD_CUSTOM_COMPONENTS` postMessage handler. Plan 2A item 13 - // extended the q2-debug-only gate to also include q2-preview. + // extended the q2-debug-only gate to also include q2-preview. revealjs + // later converged onto the same Q2PreviewIframe tree (bd-vwp4y5ku), but + // this gate wasn't updated to match, so render-components: silently + // never loaded for revealjs documents in Hub, even though the CLI's + // q2-preview-spa has no such gate at all. That gap itself isn't tracked + // under any strand as of this fix. const componentPathsKey = useMemo(() => { - if (format !== 'q2-debug' && format !== 'q2-preview') { + if (format !== 'q2-debug' && format !== 'q2-preview' && format !== 'revealjs') { return ''; }