nulogy / design-system

Nulogy Design System
http://nulogy.design
MIT License
64 stars 13 forks source link

The Dropdown menu does not allow conditional rendering of children #1303

Closed haideralsh closed 6 months ago

haideralsh commented 8 months ago

Describe the bug

In our app, we need to do this when we have to conditionally render an item inside the DropdownMenu

      <DropdownMenu>
        <DropdownButton onClick={handleItemA}>
          {t("Item A")}
        </DropdownButton>

        {allowDeletion ? (
          <DropdownButton
            onClick={handleItemB}
          >
            {t("Conditional Item B")}
          </DropdownButton>
        ) : (
          // We need to do this because of a bug in NDS
          <></>
        )}
      </DropdownMenu>

Steps to reproduce

This causes a runtime error

      <DropdownMenu>
        <DropdownButton onClick={handleItemA}>
          {t("Item A")}
        </DropdownButton>

        {allowDeletion && (
          <DropdownButton
            onClick={handleItemB}
          >
            {t("Conditional Item B")}
          </DropdownButton>
        )}
      </DropdownMenu>

Expected behaviour

No response

Is your team blocked from moving forward by the bug?

No we have a workaround described above

Who would you like to fix the bug?

When do you need this by?

N/A

Helpful resources

No response

Additional context

No response

github-actions[bot] commented 6 months ago

:tada: This issue has been resolved in version 9.0.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: