Skip to content

DialogTrigger asChild still breaks with Server Components in published @radix-ui/react-dialog because it resolves @radix-ui/react-slot@1.2.3 #3836

@maltesa

Description

@maltesa

Bug report

Current Behavior

The fix from #3165 appears to exist in @radix-ui/react-slot@1.2.4, but the latest published @radix-ui/react-dialog@1.1.15 still resolves @radix-ui/react-slot@1.2.3.

In our app, DialogTrigger asChild still breaks in a React Server Components setup when the trigger element is created on the server and passed into a client component.

With the published packages, the trigger works inconsistently in dev and disappears in our production build after hydration.

Expected behavior

DialogTrigger asChild should work in production when the child trigger is created on the server and passed into a client component.

If the fix from #3165 is the intended fix for this class of problem, the published @radix-ui/react-dialog package should pick it up in practice.

Reproducible example

We have not reduced this to a public repro yet, but the failing pattern is:

Server component:

return <EditDialog trigger={<Button>Edit</Button>} />

Client component:

'use client'

import * as Dialog from '@radix-ui/react-dialog'

export function EditDialog({ trigger }: { trigger: React.ReactNode }) {
  return (
    <Dialog.Root>
      <Dialog.Trigger asChild>{trigger}</Dialog.Trigger>
      <Dialog.Content>...</Dialog.Content>
    </Dialog.Root>
  )
}

Suggested solution

Publish a @radix-ui/react-dialog release that picks up the Slot fix from #3165, or confirm the intended supported version/workaround.

Forcing @radix-ui/react-slot@1.2.4 fixes the issue for us without any component-level workaround:

{
  "pnpm": {
    "overrides": {
      "@radix-ui/react-slot": "1.2.4"
    }
  }
}

After that override, the same production build works correctly and the dialog opens as expected.

Additional context

This looks like a published-package / release gap rather than a new root-cause bug:

  • @radix-ui/react-slot@1.2.4 appears to contain the fix from asChild doesn't work with async components #3165
  • latest published @radix-ui/react-dialog@1.1.15 still resolves @radix-ui/react-slot@1.2.3
  • overriding Slot to 1.2.4 fixes the production failure for us

Related: #3165, #3416

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-dialog, @radix-ui/react-slot 1.1.15, 1.2.3
React n/a 19.2.x
Browser Chrome current
Assistive tech n/a
Node n/a current LTS
npm/yarn/pnpm pnpm 10.x
Operating System macOS current

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions