New item not updating properly sometimes

Hi,

I have this MultiSelect control:

<SfMultiSelect TValue="int[]" TItem="Tag" @bind-Value="@SelectedTagIds"
Placeholder="Type tag name..." DataSource="@TagsAll" AllowCustomValue="true" EnableChangeOnBlur="false" Mode="@VisualMode.Box">
<MultiSelectEvents TValue="int[]" TItem="Tag"
   ValueChange="@OnTagSelectionChanged"
   CustomValueSpecifier="@OnCustomValueSpecifier"
   >
</MultiSelectEvents>
<MultiSelectFieldSettings Text="Name" Value="Id"></MultiSelectFieldSettings>
</SfMultiSelect>
  [Parameter]
  public EventCallback<int[]> SelectedTagsChanged { get; set; }
  [Parameter]
  public Func<string, Task<Tag>>? NeedSaveNewItem { get; set; }
  private async Task OnTagSelectionChanged(MultiSelectChangeEventArgs<int[]> args)
  {
      if (SelectedTagsChanged.HasDelegate)
      {
          await SelectedTagsChanged.InvokeAsync(SelectedTagIds);
      }
  }
  private async Task OnCustomValueSpecifier(CustomValueEventArgs<Tag> args)
  {
    if (!string.IsNullOrWhiteSpace(args.Text) && NeedSaveNewItem is not null)
      {
          Tag tag = await NeedSaveNewItem(args.Text);
          args.NewData = tag;
      }
  }

Sometimes (in a slower environment), the typed text (blue in image) and the new item in the dropdown list (red in image) are different.

Image_5157_1753883743657

The problem is, when I press enter then the "red" item will be saved not the "blue".

Can you help me please how can I syncronize this two items before save (to show equal values in red and blue boxes in image)?

Thank you!

BR, SZL



3 Replies

MR Mallesh Ravi Chandran Syncfusion Team August 12, 2025 04:26 AM UTC

Based on the scenario , we have validated the reported query in MultiSelect Box mode with AllowCustomValue set to true with a simple sample , and we found that the new item in the dropdown is correctly reflected on our end. Additionally, due to your concerns about slower environments, we have also tested this functionality in a slower environment (slow 4G connection), and in that scenario as well, the new item in the popup is correctly reflected in the dropdown popup.

We have prepared a testing scenario demonstration and sample application to showcase our findings.
Could you please review this and let us know if we have missed any specific testing case? Alternatively, if you could provide us with any specific scenario or steps where this issue occurs, it would help us identify and address the problem more effectively.

We appreciate your patience and look forward to your feedback.

Attachment: MultiSelect_AllowCustom_d1c45d64.zip


SZ SZL August 18, 2025 08:53 AM UTC

Hi,


Thank you for the example. Your solution works fine.

I think additional operations that I do by event (and two-way binding, and slow computer) affected the behavior of the control.


Finally I disabled the inline add function for security reasons and created a form style 'add' new item.


Have a nice day!



SS Shereen Shajahan Syncfusion Team August 19, 2025 06:01 AM UTC

Hi SZL

Thank you for the update. Please get back to us for assistance in the future.

Regards,

Shereen


Loader.
Up arrow icon