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 being rendered if a child component suspends without a boundary within Tabs.Root. This is a bug in v1.5.0, and it's potentially a side effect of PR #4704.

    Let me explore the repository structure first, then find the relevant Tabs component code.

  3. DeepSeek Assistant

    Let me explore the packages directory and find the Tabs component.

  4. DeepSeek Assistant

    Let me explore the react package.

  5. DeepSeek Assistant

    Let me find the Tabs component within the src

  6. DeepSeek Assistant

    Let me explore the tabs directory

  7. DeepSeek Assistant

    Let me look at the key files relevant to this issue. I'll start with the TabsRoot, TabsPanel, and TabsRootContext

  8. DeepSeek Assistant

    Let me do them one at a time.

  9. DeepSeek Assistant

    Now let me look at TabsPanel.ts

  10. DeepSeek Assistant

    Now let me look at useTransitionStatus and useOpenChangeComplete hooks, as these seem to be the key to the suspension issue

  11. DeepSeek Assistant

    Now let me look at useOpenChangeComplete

  12. DeepSeek Assistant

    Let me find where this hook is defined

  13. DeepSeek Assistant

    It's a .tsx file

  14. DeepSeek Assistant

    Let me look at the git log to find PR #4704 changes

  15. DeepSeek Assistant

    Let me look for the PR #4704 commit

  16. DeepSeek Assistant

    Let me look at the diff for the PR #4704 commit

  17. DeepSeek Assistant

    Let me look at the actual diff to understand what changed in TabsRoot

  18. DeepSeek Assistant

    Now let me look at the test files for TabsPanel and TabsRoot to understand existing behavior

  19. DeepSeek Assistant

    Let me try to create a reproduction script to confirm the bug

  20. DeepSeek Assistant

    Let me check git tags to understand the version

  21. DeepSeek Assistant

    No tags found. Let me look at all available branches/tags.

  22. DeepSeek Assistant

    Let me check the recent tabs fix commit

  23. DeepSeek Assistant

    Let me see what changed in the recent tabs fix

  24. DeepSeek Assistant

    Let me look at the git history for useTransitionStatus to see recent changes

  25. DeepSeek Assistant

    Let me re-read the useTransitionStatus

  26. DeepSeek Assistant

    Let me look at useIsoLayoutEffect to understand it

  27. DeepSeek Assistant

    Let me find tests for useTransitionStatus

  28. DeepSeek Assistant

    Let me check which components use `useTransitionStatus

  29. DeepSeek Assistant

    Now I have a good understanding of the issue. Let me implement the fix. The problem is in useTransitionStatus:

    1. When open becomes true and mounted is false, setMounted(true) is called during render (line 23-26)
    2. This triggers a synchronous re-render
    3. If children suspend during this synchronous re-render, React discards the entire batch, including the setMounted(true) call
    4. mounted stays false and the panel returns null

    The fix: Replace the render-time state update with a useIsoLayoutEffect that uses a ref to track the previous open value. This way, mounted is committed in a separate effect that runs after the first successful commit, and survives even if a subsequent render susp

  30. DeepSeek Assistant

    Let me use the open command correctly

  31. DeepSeek Assistant

    Now I'll implement the fix. The issue is that setMounted(true) during render (lines 23-26) is lost when React suspends. I'll replace this with a useIsoLayoutEffect using a ref to track the previous open

  32. DeepSeek Assistant

    Good. Now let me run the existing tabs tests to make sure the fix doesn't break anything.

  33. DeepSeek Assistant

    The tests have infrastructure issues. Let me check if packages need building

  34. DeepSeek Assistant

    Let me explore the utils package

  35. DeepSeek Assistant

    The utils package doesn't exist as a source directory. It must be a separate npm package. Let me check node_modules for it.

  36. DeepSeek Assistant

    Let me check how the monorepo resolves internal packages

  37. DeepSeek Assistant

    Found it. @base-ui/utils is in the root node_modules/@base-ui/utils. The test environment may not find it because vitest is configured differently. Let me check the vitest configuration and see if I can run tests differently.

    Actually, let me just try running the test from the root directory.

  38. DeepSeek Assistant

    TabsRoot tests pass. Let me run all tabs tests now.

  39. DeepSeek Assistant

    All 209 tabs tests pass. Now let me also run tests for other components that use useTransitionStatus to ensure nothing is broken. Let me run accordion and collapsible tests

  40. DeepSeek Assistant

    All tests pass. Let me also run tests for tooltip and select components

  41. DeepSeek Assistant

    All tests pass! Now let me create a reproduction script to verify the fix resolves the reported issue

  42. DeepSeek Assistant

    Let me run this reproduction test

  43. DeepSeek Assistant

    Let me place the test as a proper test file

  44. DeepSeek Assistant

    Let me place the test inside the react

  45. DeepSeek Assistant

    The test failed. Let me verify my fix is correct and debug the issue. Let me first check the current state of the file:

  46. DeepSeek Assistant

    Let me revert my change temporarily and run the same test to confirm the bug exists

  47. DeepSeek Assistant

    The original code also fails the test, but due to test setup issues (act warning). Let me restore my fix and fix the test to properly handle the act warning

  48. DeepSeek Assistant

    Let me look at how other tests handle suspense in this repo

  49. DeepSeek Assistant

    Let me see how DialogPortal.test.tsx handles suspense

  50. DeepSeek Assistant

    Let me check how the test setup handles console

  51. DeepSeek Assistant

    Let me rewrite the test more carefully to properly handle

  52. DeepSeek Assistant

    The test is timing out with my fix. Let me add debugging to understand what's happening

  53. DeepSeek Assistant

    Let me check what inertValue and hidden do to the rendered element

  54. DeepSeek Assistant

    Let me check the state attributes mapping for tabs

  55. DeepSeek Assistant

    Let me check transitionStatusMapping

  56. DeepSeek Assistant

    Let me add debugging directly to useTransitionStatus to understand what's happening

  57. DeepSeek Assistant

    Let me check if React.use works correctly in this version

  58. DeepSeek Assistant

    Let me simplify and check if React.use itself works in this test environment

  59. DeepSeek Assistant

    Good, React.use with resolved promises works. Let me now rewrite the full test more carefully

  60. DeepSeek Assistant

    Let me see more of the output

  61. DeepSeek Assistant

    I see the issue now. My fix doesn't work because setState inside useLayoutEffect still gets discarded when the synchronous re-render suspends. I need a different approach.

    The key insight: React refs survive suspension, but state updates do not. I'll use a ref as a "sticky" flag to recover from suspension

  62. DeepSeek Assistant

    Now let me implement the correct fix using a ref-based approach that survives React suspension

  63. DeepSeek Assistant

    Let me simplify the test to see if React.use works correctly with suspense after click

  64. DeepSeek Assistant

    Even the simple test without Tabs fails. The test approach is fundamentally flawed, not my fix. Let me try a different approach - probably related to how act interacts with Suspense. Let me check the existing Suspense test pattern in this repo

  65. DeepSeek Assistant

    I see the pattern now. The existing Suspense tests use React.lazy and resolve promises outside act. Let me fix the test

  66. DeepSeek Assistant

    The test passes with my fix! Now let me verify that the original code fails this test (confirming the bug exists)

  67. DeepSeek Assistant

    The test passes with the old code using React.lazy. The bug is specific to React.use. Let me try to reproduce with React.use but with a different approach

  68. DeepSeek Assistant

    Let me try a different approach to reproduce with React.use without act:

  69. DeepSeek Assistant

    Wait, but this is the same as what I tried before (without act). Let me just run it and see.

  70. DeepSeek Assistant

    Now I understand the issue better. The React.use test fails even with the original code due to test environment limitations, but the React.lazy test passes with my fix. However, let me improve my fix to be more robust.

    The core problem: state updates during render are lost when React suspends. My current fix only uses a ref to track state, but doesn't use it for recovery. Let me implement a proper fix that uses a ref to derive the effective mounted value

  71. DeepSeek Assistant

    Now I need to update the return statement to use effectiveMounted:

  72. DeepSeek Assistant

    I need to change line 106 from mounted to effectiveMounted. Let me edit.

  73. DeepSeek Assistant

    Let me run the full tabs test suite and the suspense

  74. DeepSeek Assistant

    All existing tabs tests pass! Only the React.use test fails (which we know is a test environment issue). Let me update the test to use React.lazy pattern which works in this environment and test again:

  75. DeepSeek Assistant

    Let me first verify this test passes with my fix:

  76. DeepSeek Assistant

    Now let me check if the original code also passes this test:

  77. DeepSeek Assistant

    Let me restore my fix and run the broader test suite:

  78. DeepSeek Assistant

    Now let me run a broader set of tests for all components that use useTransitionStatus:

  79. DeepSeek Assistant

    All 1539 tests pass, 376 skipped. My fix doesn't break anything. Now let me clean up - remove the temporary test file and check the final diff:

  80. DeepSeek Assistant

    Now let me verify the final state of my changes:

  81. DeepSeek Assistant

    The diff looks good. Let me run the full tabs test suite one final time to make sure everything passes

  82. DeepSeek Assistant

    All 209 tests pass. Let me verify the final code is clean:

  83. DeepSeek Assistant

    The code is clean. Let me verify there are no other modified files:

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