Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek/deepseek-v4-pro· deepseekHugging 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

    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. DeepSeek Assistant

    Let me start by understanding the repository structure and the issue. The issue is about Tabs.Panel content not rendering if a child component suspends without a boundary within Tabs.Root. Let me first explore the repository structure and then look at the relevant code.

    The issue mentions this is potentially a side effect of PR #4704. Let me explore the tabs component and understand what changed.

  3. DeepSeek Assistant

    Let me look at the tabs package structure and find the relevant files.

  4. DeepSeek Assistant

    Let me look at the react package structure and find the tabs component.

  5. DeepSeek Assistant

    Let me look at the tabs directory.

  6. DeepSeek Assistant

    Let me look at the key files in the tabs component, starting with the panel and root implementations

  7. DeepSeek Assistant

    Let me look at them one at a time.

  8. DeepSeek Assistant

    Now let me look at the root component and its context to understand the registerMountedTabPanel and unregisterMountedTabPanel functions.

  9. DeepSeek Assistant

    Now let me examine the hooks used by the panel:

  10. DeepSeek Assistant

    Now let me look at useOpenChangeComplete:

  11. DeepSeek Assistant

    Let me find it.

  12. DeepSeek Assistant

    It's a .tsx file.

  13. DeepSeek Assistant

    Let me look at useIsoLayoutEffect:

  14. DeepSeek Assistant

    Let me look at the git history to understand what PR #4704 changed:

  15. DeepSeek Assistant

    Let me search for the PR that might be related. Let me look at git log for tabs-related changes

  16. DeepSeek Assistant

    Let me look at the changes introduced by PR #470

  17. DeepSeek Assistant

    Let me check the git diff for TabsPanel.tsx to see when it was last changed:

  18. DeepSeek Assistant

    Let me first try to reproduce the issue. Let me create a test script.

  19. DeepSeek Assistant

    Let me check the existing test files for tabs

  20. DeepSeek Assistant

    Let me first look at the playground

  21. DeepSeek Assistant

    Let me now try to reproduce the issue. First, let me look at how tests are structured and run:

  22. DeepSeek Assistant

    Let me run the existing tabs tests to see if they pass:

  23. DeepSeek Assistant

    All existing tests pass. Now let me create a reproduction script to confirm the issue.

  24. DeepSeek Assistant

    Let me place this test in the right location and run it.

  25. DeepSeek Assistant

    Now let me run this test:

  26. DeepSeek Assistant

    I've confirmed the issue. The panel content is not rendered after the suspense resolves. Let me look at what changed in PR #4704 more carefully, as the issue mentions it's potentially a side effect of that PR.

  27. DeepSeek Assistant

    Let me look at how tabMap gets populated - let me check the TabsTab component.

  28. DeepSeek Assistant

    Let me look at the CompositeList and useCompositeItem to understand how tabMap gets populated:

  29. DeepSeek Assistant

    Let me look at useCompositeItem to understand item

  30. DeepSeek Assistant

    Let me look at useCompositeListItem:

  31. DeepSeek Assistant

    Let me also look at useControlled to understand the value state management:

  32. DeepSeek Assistant

    Let me create a more targeted test to debug the issue:

  33. DeepSeek Assistant

    Let me run this debug test

  34. DeepSeek Assistant

    Very interesting! The test reveals:

    1. After clicking Tab B, the value stays as "a" (Tab A still aria-selected="true", React hides the old UI with display: none)
    2. After promise resolves, both tabs have aria-selected="false" and no tabpanels exist — meaning value is null

    This suggests tabMap.size === 0 triggers a value reset. Let me add debug logging to trace the issue:

  35. DeepSeek Assistant

    Let me run this test.

  36. DeepSeek Assistant

    Now I see it clearly! The onValueChange(null, "missing") is being called. Let me trace why tabMap becomes empty. Let me add more debugging to the TabsRoot component itself.

  37. DeepSeek Assistant

    Let me see the full effect:

  38. DeepSeek Assistant

    I've confirmed the issue: onValueChange(null, "missing") is being called. Let me now trace how tabMap gets populated. I need to check how setTabMap connects to CompositeList:

  39. DeepSeek Assistant

    Let me search for "setTabMap" in the tabs directory:

  40. DeepSeek Assistant

    Let me look at TabsList where setTabMap is passed as onMapChange to CompositeList:

  41. DeepSeek Assistant

    I see setTabMap is passed to CompositeRoot. Let me check it:

  42. DeepSeek Assistant

    Let me check if IDs change between renders:

  43. DeepSeek Assistant

    Let me check the base useId:

  44. DeepSeek Assistant

    Let me add temporary debug logging to the TabsRoot effect to trace exactly when tabMap.size changes:

  45. DeepSeek Assistant

    Now let me run the test with this debug logging:

  46. DeepSeek Assistant

    Now I can see the exact problem. The effect runs with tabMap.size: 0 during the retry and resets the value. Let me check why useCompositeListItem re-runs. Let me add logging to useCompositeListItem:

  47. DeepSeek Assistant

    I see there's a duplicate of the effect. Let me look at the full file and fix it:

  48. DeepSeek Assistant

    I accidentally broke the file. Let me restore it to its original state:

  49. DeepSeek Assistant

    Let me check useStableCallback:

  50. DeepSeek Assistant

    Now I understand the root cause. The tabMap briefly becomes empty during the suspense retry because useCompositeListItem's cleanup effect runs (unregistering tabs) before the new effect re-registers them. This triggers setTabMap(empty) → TabsRoot effect sees tabMap.size === 0 with didRegisterTabsRef.current === true → resets value to null.

    Let me restore the debug logging and implement the fix. First, let me restore TabsRoot.tsx:

  51. DeepSeek Assistant

    Now let me implement the fix. The issue is that tabMap briefly becomes empty during effect cleanup/registration cycles, triggering the commitAutomaticValueChange(null, REASONS.missing) call.

    The fix: defer the empty-tabMap check using a microtask, and cancel it if tabs reappear before the microtask runs.

  52. DeepSeek Assistant

    Now let me implement the fix. I'll use a queueMicrotask approach to defer the empty-map check, avoiding the transient empty state during effect cleanup/registration cycles:

  53. DeepSeek Assistant

    Now I need to also add the cancellation of the pending check when tabMap is non-empty. Let me add that:

  54. DeepSeek Assistant

    Now let me run the suspense test to see if the fix works:

  55. DeepSeek Assistant

    The fix works! Now:

    • onValueChange is only called once with {"value":"b","reason":"none"} (no spurious null reset)
    • Tab B has aria-selected="true"
    • The panel content is properly rendered: "Panel B is rendered"

    Now let me run all the existing tabs tests to make sure I haven't broken anything:

  56. DeepSeek Assistant

    All 172 tests pass (38 skipped), including the new suspense test. Let me now clean up the temporary test file and verify the final state:

  57. DeepSeek Assistant

    Let me verify the final state of the changed file:

  58. DeepSeek Assistant

    The diff looks clean. Let me run the full tabs test suite once more to confirm everything passes:

  59. DeepSeek Assistant

    All tests pass. Let me also verify no other files were modified:

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