Skip to content
TheChatArchiveThe Chat Archive
gpt-5.6-sol· openaiHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [tabs] Tabs.Panel content not rendered if a child component suspends…

  1. User

    ISSUE DESCRIPTION

    [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.Root component), 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.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /base-ui, current file: none) bash-$

  2. Assistant

    I’ll first inspect the repository structure, recent Tabs-related history, and the implementation/tests around panel mounting and transitions. Then I’ll reproduce the Suspense scenario with the project’s existing test infrastructure before making a focused fix.

  3. Assistant

    The history contains both the suspected regression commit and a newer “[tabs] Fix state edge cases” commit, so I’ll compare those changes and inspect the current source/tests to determine whether the checkout contains a partial fix or whether this Suspense case remains uncovered.

  4. Assistant

    TabsPanel derives whether it renders from useTransitionStatus(open). The likely failure mechanism is that a render-time selection update or transition state is lost when React discards the suspended render and remounts the root. I’ll inspect useTransitionStatus, the complete root selection flow, and the exact regression diff from #4704.

  5. Assistant

    The regression diff is centered on root automatic-selection effects, but the reported sequence also exposes a known weakness of render-phase state updates in useTransitionStatus: the panel calls setMounted(true) during a render that is then abandoned by Suspense. I’ll inspect the pre-1.5 root/panel and dependency history, then create a temporary focused test (without adding repository tests) using the existing renderer and React 19 use() behavior.

  6. Assistant

    The transition hook predates the regression, making root state restoration the stronger suspect: #4704 introduced automatic fallback logic that can observe an empty tabMap after Suspense tears down layout effects and overwrite the user-selected value. I’ll run the exact scenario in a standalone /tmp script using jsdom and the package source, logging the selected tab and panel before, during, and after promise resolution.

  7. Assistant

    The standalone script only failed because /tmp defaults to CommonJS and disallows top-level await. I’ll wrap it in an async function and rerun unchanged behaviorally.

  8. Assistant

    Python is unavailable in this environment, so I’ll use standard shell concatenation to wrap the script and rerun it.

  9. Assistant

    The first failed wrapping attempt evidently left a partial wrapper in the file despite the missing Python command. I’ll inspect and normalize the temporary script’s first/last lines before rerunning.

  10. Assistant

    That normalization removed the import rather than the duplicate wrapper, and the async rejection did not produce useful output. I’ll rewrite the small temporary script cleanly with static imports (which are valid in CommonJS-transformed TSX) and put all awaits inside main.

  11. Assistant

    Because Node resolves dependencies relative to /tmp, it cannot see the repository’s workspace links. I’ll set NODE_PATH to the repository node_modules for this temporary script; no repository files need to be added.

  12. Assistant

    Node 24 already exposes a read-only navigator, so the jsdom setup should not assign it. I’ll remove that assignment and rerun; the remaining DOM globals are writable.

  13. Assistant

    The issue is reproduced exactly: after the first click and promise resolution, Tab A remains selected and the fallback remains visible. I’ll augment only the temporary script to confirm the reported second-click recovery and instrument onValueChange reasons, which will reveal whether the new automatic fallback logic resets value during Suspense cleanup.

  14. Assistant

    No automatic fallback callback fires; instead React loses the first uncontrolled setValue('b') update when the same render suspends, while the second post-resolution update commits. I’ll inspect the exact #4704 changes to onValueChange, controlled state initialization, and activation-direction synchronization, and use a minimal local patch/repro cycle to isolate which state update interaction causes React to drop the selection.

  15. Assistant

    The key new behavior is explicit: before #4704, tabMap.size === 0 always returned; v1.5 treats an empty map after initial registration as “all tabs removed” and sets the uncontrolled value to null. Suspense temporarily disconnects refs for the hidden root, making that transient state indistinguishable from removal. I’ll first patch that branch to defer handling the empty map and rerun the exact repro. If it resolves the issue, I’ll evaluate how to preserve genuine “all tabs removed” behavior without reacting to Suspense’s transient ref cleanup.

  16. Assistant

    Bash history expansion interpreted the ! in the JavaScript replacement. I’ll use the repository’s non-interactive replace helper instead, which safely handles the multiline source, then rerun the repro.

  17. Assistant

    The editor helper located the code but requires the occurrence to be in the active window. I’ll open around line 287, apply the same replacement, and rerun.

  18. Assistant

    Deferring only size === 0 is insufficient, indicating Suspense leaves tabMap entries whose metadata is temporarily null; then selectedTabMetadata is missing and firstEnabledTabValue is undefined, so the effect still commits null. I’ll inspect CompositeList registration semantics and existing root tests for removal/all-disabled behavior to design a guard for transiently disconnected metadata rather than broadly reverting functionality.

  19. Assistant

    CompositeList confirms the important distinction: it filters/unregisters tabs during Suspense effect disconnection even though their DOM nodes remain connected (React hides them), whereas genuinely removed tabs become disconnected. I’ll preserve the latest known element per tab value, prune genuinely disconnected entries, and suppress “missing” fallback only while the selected tab’s known element is still connected. This retains #4704’s real-removal behavior and handles both partially and fully cleared maps.

  20. Assistant

    The backup was not created because the earlier shell command aborted before cp; I’ll restore the five-line empty-map behavior manually, add the connected-element cache/guard near selection derivation, and include the guard in the effect dependencies.

  21. Assistant

    The cache is in place and the original empty-map fallback is restored. I still need to wire the actual transient-disconnection predicate into the automatic-selection effect; I’ll add it after metadata lookup, return early when true, then rerun the repro.

  22. Assistant

    The source edits completed, but invoking pnpm triggered Corepack’s unsupported interactive download prompt and timed out before formatting/reproduction. I’ll inspect the edited region for line-range correctness, then use the already-installed Prettier binary directly and rerun.

  23. Assistant

    The guard experiment did not fix the repro, so the automatic-selection effect is not the root cause; I’ll discard that speculative root change. The panel logic reveals the direct failure: when open first becomes true, useTransitionStatus queues mounted=true during render, but TabsPanel still returns null based on the stale mounted value. If the subsequent render suspends, that render-phase mount update can be abandoned. I’ll verify conventions in other popup/content components, then change the panel’s immediate render condition to include open so the selected content participates in every retry.

  24. Assistant

    Other panels already use open as an immediate rendering condition (notably Collapsible), while preserving mounted for exit transitions. For Tabs, the robust derivation is hidden = !open && !mounted and shouldRender = keepMounted || open || mounted: opening content renders immediately, and closing content remains mounted until transition completion. I’ll apply this focused change and rerun the exact Suspense reproduction before broader tests.

  25. Assistant

    The panel-only change does not resolve the standalone reproduction, so the discarded root interaction is still implicated (and my earlier guard was malformed by line drift, so it was not a valid test). Before changing direction again, I’ll inspect full DOM markup and extend the post-resolution wait to exclude jsdom scheduling artifacts, then instrument root’s automatic effect transiently with console output to capture value, tabMap, and fallback decisions.

  26. Assistant

    The DOM confirms React keeps the committed root connected but hidden. The standalone script performs updates outside React act, which can prevent deterministic Suspense retry flushing in a test environment. I’ll update the temporary script to wrap render, click, and promise resolution in act; this should align it with both browser event/testing behavior and clarify whether the panel change itself works.

  27. Assistant

    With proper React flushing, the focused change resolves the exact issue: after promise resolution, Tab B is selected and its content is present on the first click. To prove this is not merely the corrected harness behavior, I’ll temporarily restore the original panel, rerun the same act-based script to confirm failure, then reapply the two-line fix.

  28. Assistant

    The corrected harness also succeeds on React 19.2 without the patch, suggesting the current React release has improved retry behavior; however, the reported v1.5 regression depends on an abandoned render-phase mounted update, and the robust library-side fix is still to render whenever open is true. Only shouldRender needs this change—altering hidden is unnecessary because React processes the render-phase update before commit. I’ll narrow the patch to that single semantic change, then run the Tabs panel/root suites in jsdom and Chromium if available, plus type checking for the package.

  29. Assistant

    The focused jsdom suites pass (118 passed, 28 browser-only skipped). I’ll now run the same Tabs suites in Chromium to cover transition behavior and real Suspense/DOM scheduling, then run package TypeScript/lint checks using direct local binaries or workspace commands that avoid Corepack prompts.

  30. Assistant

    Chromium cannot run because the Playwright browser executable is not installed; this is an environment limitation rather than a test failure. The jsdom suites already cover all non-animation logic, and the change is type-neutral. I’ll still run the React package’s available TypeScript and ESLint checks directly, then inspect the final one-line diff and repository status for accidental files.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.