Timeline item do not update / re-render
See original GitHub issueDescribe the bug
Timeline item do not update / re-render when model change.
Steps to reproduce (please include code)
<Timeline>
@foreach (var item in model.Items)
{
<TimelineItem>
<span>@item.Text</span>
</TimelineItem>
}
</Timeline>
<Button OnClick="() => visible = true">Update</Button>
<Modal Title="Title.."
Visible="@visible"
OnOk="@HandleOk"
ConfirmLoading="@confirmLoading"
OnCancel="@HandleCancel">
<p>
test..
</p>
</Modal>
@code
{
private bool visible = false;
private bool confirmLoading = false;
private TestComponentParam model = new()
{
Items = new List<TestComponentParamItem>()
{
new()
{
Text = "A",
},
new()
{
Text = "B",
},
new()
{
Text = "C",
},
new()
{
Text = "D",
},
},
};
private async Task HandleOk(MouseEventArgs e)
{
confirmLoading = true;
await Task.Delay(500);
model.Items = model.Items.Select(x => new TestComponentParamItem
{
Text = x.Text + "x",
}).ToList();
visible = false;
confirmLoading = false;
}
private void HandleCancel(MouseEventArgs e)
{
visible = false;
}
public class TestComponentParam
{
public List<TestComponentParamItem> Items { get; set; }
}
public class TestComponentParamItem
{
public string Text { get; set; }
}
}
Further technical details
- AntDesign Nuget Package version: 0.7.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Why is my React component not re-rendering upon state ...
My code seems to update the state 'selectedDate' but the component does not re-render. I have tried swapping the state to a number...
Read more >[Bug] Cluster items dont get rerender after update #741
Hello! look at this jsbin For some reason, an update call to the dataset isn't making any UI changes to items of type...
Read more >Google Timeline Rerender problem
It works fine the first time but everytime I click on the update button the elements inside timeline don't appear.
Read more >React component won't re-render on state change
I need to change another aspect of state (from useSelector) to actually force the react component to re-render, displaying the button. Here is...
Read more >re-render timeline instance not working in a React app
I try to briefly describe my problem: I wrote a React application to generate a series of animations on a web page. Each...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @jirisykora83 , thanks for contacting us.
Please add a @key for loop. There is the official doc about this. Use @key to control the preservation of elements and components
Can you provide a better example to illustrate this please?