question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Immediately Changing Value after item is modified in Select

See original GitHub issue

Describe the bug

A clear and concise description of what the bug is.

RuleGroup ruleGroupToSelect = null;
ruleGroupToSelect = new()
{
    GroupName = this.NewGroupName
};
this.RuleGroups.Add(ruleGroupToSelect);
this.SelectedGroup = ruleGroupToSelect;

Where this.SelectedGroup has already bound to Value of Select. SelectOptions loop through the list this.RuleGroups. After the last assignment, Select shows nothing.

Steps to reproduce (please include code)

Do something as described in the code above.

Exceptions (if any)

no.

Further technical details

  • AntDesign Nuget Package version - 0.8.0
  • Include the output of dotnet --info - .NET 5.0
  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and it’s version - not relevant.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
anddrzejbcommented, Jun 7, 2021

I haven’t really started working on this (I am pretty swamped lately), but the behaviour is not really surprising. Select is async when it comes to populating its content (the select items). The selected value has to exist in the list of select item. Your original code was synchronous. I am afraid this issue might not be fixable, however I do plan to have a more thorough look.

1reaction
anddrzejbcommented, Jun 6, 2021

@Banyc Thanks for waiting! I haven’t really looked deep into this issue, but if you switch this:

    private void OnAddItem()
    {
        var newModel = new MyModel()
        {
            Name = this.NewName
        };
        this.Models.Add(newModel);
        // make the select display the new item
        this.SelectedModel = newModel;
    }

with this

    private async Task OnAddItem()
    {
        var newModel = new MyModel()
        {
            Name = this.NewName
        };
        this.Models.Add(newModel);
        await Task.Yield();
        // make the select display the new item
        this.SelectedModel = newModel;
    }

It should start working. Obvious first impression is that there is an async operation pending in-between your synchronous changes. Since async operation has no chance of completing, second operation (assignment of the new value), does not seem to work. I will have a closer look, but if you need it quickly, this is the immediate solution. Mind, this might be final as well, but I will get back to you on this subject.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When item is created or modified update item
Now, you'd have an 'update item' step, where you'd use the IDs that were found from the "Get Items" step, and update the...
Read more >
SQL: selecting rows where column value changed from ...
It will return first row and rows where value is different. ... Since mysql don't have Qualify and is distinct from functions: SELECT...
Read more >
Power Automate SharePoint Item Modified flow - YouTube
We can track to see the column changes for the modified item, leverage the send an http SharePoint action to get previous values...
Read more >
Select Component will not update selected value after I ...
if the selected Option's label changed, the label on Select component should also change. What is actually happening? only Options updated.
Read more >
PowerAutomate - Get Column before & After value changes
This video explains how to get previous value of field changes in SharePoint item using Power Automate. Watch full video to understand how ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found