unovue / shadcn-vue

Vue port of shadcn-ui
https://www.shadcn-vue.com/
MIT License
4.59k stars 267 forks source link

[Bug]: alert-dialog crashes #724

Closed han1548772930 closed 1 month ago

han1548772930 commented 1 month ago

Reproduction

alert-dialog crashes

Describe the bug

<DropdownMenu>
    <DropdownMenuTrigger as-child>
      <Button class="w-[40px] h-[40px]">
        12313
      </Button>
    </DropdownMenuTrigger>
    <DropdownMenuContent class="text-[14px]">
      <DropdownMenuItem  class="cursor-pointer">
        <AlertDialog>
          <AlertDialogTrigger as-child>
            <div class="w-full h-full">
              <Icon icon="mi:log-out"/>
              <span>out</span>
            </div>
          </AlertDialogTrigger>
          <AlertDialogContent>
            <AlertDialogHeader>
              <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
              <AlertDialogDescription>
                This action cannot be undone. This will permanently delete your account
                and remove your data from our servers.
              </AlertDialogDescription>
            </AlertDialogHeader>
            <AlertDialogFooter>
              <AlertDialogCancel>Cancel</AlertDialogCancel>
              <AlertDialogAction>Continue</AlertDialogAction>
            </AlertDialogFooter>
          </AlertDialogContent>
        </AlertDialog>
      </DropdownMenuItem>
    </DropdownMenuContent>
  </DropdownMenu>

System Info

When I click on DropdownMenuItem, AlertDialog crashes

Contributes

han1548772930 commented 1 month ago

This will display normally

  <AlertDialog>
    <DropdownMenu>
      <DropdownMenuTrigger as-child>
        <Button class="w-[40px] h-[40px]">
          12313
        </Button>
      </DropdownMenuTrigger>
      <DropdownMenuContent class="text-[14px]">
        <!--                  <DropdownMenuSeparator/>-->
        <DropdownMenuItem class="cursor-pointer">

          <AlertDialogTrigger as-child>
            <div class="w-full h-full">
              <Icon icon="mi:log-out"/>
              <span>out</span>
            </div>
          </AlertDialogTrigger>
        </DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
    <AlertDialogContent>
      <AlertDialogHeader>
        <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
        <AlertDialogDescription>
          This action cannot be undone. This will permanently delete your account
          and remove your data from our servers.
        </AlertDialogDescription>
      </AlertDialogHeader>
      <AlertDialogFooter>
        <AlertDialogCancel>Cancel</AlertDialogCancel>
        <AlertDialogAction>Continue</AlertDialogAction>
      </AlertDialogFooter>
    </AlertDialogContent>
  </AlertDialog>