trimble-oss / modus-web-components

This library provides Modus components as web components - reusable, encapsulated UI elements that are framework agnostic (can be implemented in any site).
https://modus-web-components.trimble.com/
MIT License
34 stars 71 forks source link

Select Component's Bound Value Should Not Compare By Reference #2878

Open kuhnboy opened 1 week ago

kuhnboy commented 1 week ago

Prerequisites

Describe the issue

In the select component implementation (https://github.com/trimble-oss/modus-web-components/blob/3dd6a720295fbac75aa1dd11279d6f25db174c85/stencil-workspace/src/components/modus-select/modus-select.tsx#L115)

The implementation assumes that your value that is selected by default should be referentially equal to one of the options:

<option value={optionId} key={optionId} selected={option === this.internalValue}>

Which in many cases can prevent easy use of this component.

Similar to options-display-prop (JS optionsDisplayProp) there should be an options-value-prop (JS optionsValueProp) for a selector of the value that then should be compared instead of the object reference.

Reduced test cases

No response

What operating system(s) are you seeing the problem on?

No response

What browser(s) are you seeing the problem on?

No response

What is the issue regarding ?

@trimble-oss/modus-web-components

What version of npm package are you using ?

0.38.0

Priority

Medium

What product/project are you using Modus Components for ?

ModusBlazor

What is your team/division name ?

AECO

Are you willing to contribute ?

None

Are you using Modus Web Components in production ?

No response

github-actions[bot] commented 1 week ago

Hello @kuhnboy! Thanks for opening an issue. The Modus core team will get back to you soon (usually within 24-hours) and provide guidance on how to proceed. Contributors are welcome to participate in the discussion and provide their input on how to best solve the issue, and even submit a PR if they want to.

Please wait until the issue is ready to be worked on before submitting a PR, or you can reach out to the core team if it is time bound. For trivial things, or bugs that don't change the expected behaviors and UI, you can go ahead and make a PR.