Closed ptallett closed 5 years ago
HI @ptallett, the Dropdown selectedKeys prop expect a very specific type and the @observable
decorator has likely violated the "contract". We are not able to have all our components support MobX decorated types because our component library is meant to be data-flow agnostic and there are real costs (in bundle size) to adding framework specific support. We are therefore very unlikely to ever "fix" this issue. (Fortunately, as you have also identified, there are easy workarounds).
You could trivially put the slice in the codebase.
Unfortunately, we need to be principled about things like this. A component library needs some amount of "coherence" in its API surface and it would simply not work for only one random prop to apply slice()
while all our other props do not. There are also other considerations as well but hopefully this helps you understand a bit why we must decline adding slice
into the component layer at this point.
This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your contributions to Fabric React!
Environment Information
Please provide a reproduction of the bug in a codepen:
If the selectedKeys array is an @observable from mobx, then Dropdown doesn't allow selection.
@observable selectedKeys: string[];
Actual behavior:
Unable to select items in the dropdown
Expected behavior:
Dropdown should update when items are clicked.
Priorities and help requested:
Are you willing to submit a PR to fix? (Yes, No) No
Requested priority: (Blocking, High, Normal, Low) Normal
Products/sites affected: (if applicable) Simple workaround - this.selectedKeys.slice()