You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browser and version: Chrome v126.0.6478.128 (Official Build) (64-bit)
COREui PRO react version: latest - 5.2.0
If the prop options change, the component is not redrawn.
If the prop options is emptied (empty array provided), placeholder still shows the previous selection though there are no options to select from
When new options prop is provided the onChange is not fired, meaning that submitting the form will keep the old value!
There is no easy way to reset the selection programmatically, without using the cleaner prop - it forces devs to remove the component from the view briefly in order to force re-render!
Feature: Please provide a way to programmatically deselect/clear selection ...
Test case:
....useEffect(()=>{if(!item.tenant_id||!item.category_id)returnloadGroups()},[item.tenant_id,item.category_id])asyncfunctionloadGroups(){constgroupsResponse=awaitgetAiAgentsGroups(auth,{tenant: item.tenant_id,category: item.category_id,})initGroupSelectOptions(groupsResponse.results??[],groupId)}functioninitGroupSelectOptions(groups,selected){setGroupSelectOptions(groups.map(({ id, name })=>({label: name,value: id,selected: id===selected,})),)}// ...return<CMultiSelectoptions={groupSelectOptions}multiple={false}cleaner={false}optionsStyle="text"optionsMaxHeight={300}onChange={(selectedOptions)=>handleSelectChange(selectedOptions,setItem,'agentgroup_id')}/>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions
const[test,setTest]=useState([]);<>{JSON.stringify(test)}<CMultiSelectlabel={"test"}onChange={()=>{}}multiple={false}options={test}/><buttononClick={()=>{setTest([{value:Math.random(),label: "RANDOM VALUE "+Math.random(),selected: true}])}}>TEST</button></>
When pressing the button, only the first time it will recreate the list, and after that only the first selected remains.
One thing is interesting, after multiple list updates, if you switch the multiple prop to true, you will see all items as selected.
My guess is the list is always updated, never deleted, and when multiple is false, it takes the first one in the list.
If the prop
options
change, the component is not redrawn.If the prop
options
is emptied (empty array provided), placeholder still shows the previous selection though there are no options to select fromWhen new
options
prop is provided theonChange
is not fired, meaning that submitting the form will keep the old value!There is no easy way to reset the selection programmatically, without using the
cleaner
prop - it forces devs to remove the component from the view briefly in order to force re-render!Feature: Please provide a way to programmatically deselect/clear selection ...
Test case:
Gif recording:
Similar previous closed bug: #268
The text was updated successfully, but these errors were encountered: