Untitled conversation
- User
[tabs] Tabs.Panel content not rendered if a child component suspends without boundary within Tabs.Root
Bug report
Current behavior
If a tab panel has a child that suspends and the suspense unmounts the tab root (i.e., the next boundary is outside the
Tabs.Rootcomponent), the panel content is not rendered when opening a tab for the first time.Only when clicking the trigger a second time, the panel is rendered.
Expected behavior
The panel content is rendered also when first opening a tab like it did in v1.4.1.
Reproducible example
Click on tab B in this Stackblitz
Alternatively, run this code snippet locally:
import { Tabs } from '@base-ui/react/tabs'; import { Suspense, use } from 'react'; // Promise used to suspend. const dataPromise = new Promise<string>((resolve) => setTimeout(() => resolve('Panel B is rendered'), 500) ); function SuspendingChild() { return <div>{use(dataPromise)}</div>; } export default function App() { return ( // The Suspense boundary is outside the <Tabs.Root> and the panels/panel content don't use a separate suspense boundary. <Suspense fallback={<div>Loading…</div>}> <Tabs.Root defaultValue="a"> <Tabs.List> <Tabs.Tab value="a">Tab A</Tabs.Tab> <Tabs.Tab value="b">Tab B</Tabs.Tab> </Tabs.List> <Tabs.Panel value="a">Panel A (no suspense)</Tabs.Panel> <Tabs.Panel value="b"> <SuspendingChild /> </Tabs.Panel> </Tabs.Root> </Suspense> ); }Base UI version
The only affected version is v1.5.0
v1.4.1 is not affected
Which browser are you using?
Reproducible in Chrome/Safari/Firefox
Additional context
Potentially a side effect of https://github.com/mui/base-ui/pull/4704
Interface
No new interfaces are introduced.
- Assistant
Now let me check how tabs register and look at the test setup:
- Assistant
The test reproduces the bug — "Panel B content" isn't rendered. Let me clean up the act warning:
- Assistant
The fix works. Now let's check for regressions — this touches shared infrastructure used by many components. First the tabs and composite suites:
- Assistant
While that runs, let me check other consumers of
subscribeMapChangeto see if the listener broadcast needs the same treatment: - Assistant
Full jsdom suite passes (6370 tests). Now eslint and the Chromium env for the affected suites:
- Assistant
The regex filter isn't supported — running the suites individually:
- Assistant
While waiting, let me review the final diff:
- Assistant
Typecheck passed. But CI runs tests against React 18, where
React.usedoesn't exist. Let me check how other tests handle version differences: - Assistant
Sanity check — verify the reworked test still fails without the fix:
- Assistant
Confirmed: fails without the fix, passes with it. Let me check the Chromium runs for other CompositeList consumers:
- Assistant
useCompositeRoot.onMapChangealready ignores empty maps and only acts once, so skipping stale calls is safe there too. Combobox Chromium passed. Waiting on the remaining suites: - Assistant
Waiting for the remaining Chromium suites to complete.
- Assistant
While waiting for those results, let me verify the typecheck output from earlier:
- Assistant
Typecheck is clean. Now I'll wait for the remaining Chromium suites (Select/Menu/Slider/Toolbar) to report.
- Assistant
All checks are queued. Current status:
Check Result New repro test (jsdom) ✅ fails without fix, passes with fix Full jsdom suite (6370 tests) ✅ passed Tabs + Composite + Combobox (Chromium) ✅ passed TypeScript ✅ clean Prettier ✅ clean Select/Menu/Slider/Toolbar (Chromium) ⏳ running Full eslint ⏳ running I'll confirm once the remaining runs complete.
- Assistant
The lint error is in my new test — the repo's rule forbids wrapping
fireEventinact. Let me check how existing tests handle suspension-triggering events: - Assistant
Lint and formatting are now clean (the full eslint run's only error was the one I just fixed). Just waiting on the Select/Menu/Slider/Toolbar Chromium chain — the monitors will report when it completes.
- Assistant
The change set is final. Waiting on the last Chromium verification run before wrapping up.
- Assistant
All verification is complete. Summary of the fix:
Root cause
When a
Tabs.Panelchild suspends and the nearestSuspenseboundary sits outsideTabs.Root, React hides the whole tabs tree and disconnects its effects, then reconnects them on reveal. During the reveal commit:- Each
Tabs.Tabre-registers intoCompositeList's mutable map (child layout effects run first).
- Each
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.