Skip to content

[dialog] Suspense across portal causes "Maximum update depth exceeded." error #3695

@morditore

Description

@morditore

Bug report

Current behavior

When a component within Dialog.Portal triggers a Suspense boundary outside of it, the component seems to be crashing with the following.

Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

<Suspense fallback="Loading...">
  <Dialog.Root open={true}>
    <Dialog.Portal>
      <Dialog.Popup>
        {/* Triggers Suspense */}
        <Message />
      </Dialog.Popup>
    </Dialog.Portal>
  </Dialog.Root>
</Suspense>

Expected behavior

No error is thrown.

Reproducible example

https://codesandbox.io/p/sandbox/base-ui-dialog-suspense-m7h2l3

Base UI version

1.0.0

Which browser are you using?

Chrome

Which OS are you using?

Mac OS

Additional context

  • If the Suspense boundary itself is inside the Portal, the error is not present.
  • This scenario is working in Radix

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: dialogChanges related to the dialog component.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions