decentraland / creator-hub

MIT License
0 stars 4 forks source link

If there are two elements in the select with the same label, only one is shown (bug) #170

Open menduz opened 1 year ago

menduz commented 1 year ago

Issue

Bug: If multiple options are repeated, the select input only shows one. Expected behavior: All options are shown, repeated.

Test snippet:

export const ui = () => {
  return (
    <UiEntity
      uiTransform={{
        width: "100%",
        height: "3000px",
        flexDirection: YGFlexDirection.YGFD_COLUMN
      }}
    >
      <Dropdown options={['Red', 'Red', 'Red', 'Red']} />
    </UiEntity>
  )
}

ReactEcsRenderer.setUiRenderer(ui)

https://playground.decentraland.org/?sdk-branch=refactor%2Fpointer-event&renderer-branch=feat%2Fsdk7_ui_components&code=ZXhwb3J0IGNvbnN0IHVpID0gKCkgPT4gewogIHJldHVybiAoCiAgICA8VWlFbnRpdHkKICAgICAgdWlUcmFuc2Zvcm09e3sKICAgICAgICB3aWR0aDogIjEwMCUiLAogICAgICAgIGhlaWdodDogIjMwMDBweCIsCiAgICAgICAgZmxleERpcmVjdGlvbjogWUdGbGV4RGlyZWN0aW9uLllHRkRfQ09MVU1OCiAgICAgIH19CiAgICA%2BCiAgICAgIDxEcm9wZG93biBvcHRpb25zPXtbJ1JlZCcsICdSZWQnLCAnUmVkJywgJ1JlZCddfSAvPgogICAgPC9VaUVudGl0eT4KICApCn0KClJlYWN0RWNzUmVuZGVyZXIuc2V0VWlSZW5kZXJlcih1aSkK

0xD-Fabio commented 1 year ago

After some experiments and documentation digging, we discovered that this problem is caused by design in the Unity's implementation of this Ui element.

  1. This may require a full rewrite of these kinds of Ui elements because the unity ones are not extensible.
  2. There may be some workaround (like adding numbers to the end of the string in the dropdown menu), but that would be a really bad hack, and we would have more tech debt to address later on.