Hi, I have a problem with my DataGrid component. In my code I have a method which is called when I need to refresh the data in the grid (it is called, after creating, editing or deleting an item). I handle that on my own with my custom modal and EF Core. Below is my method code:
public async Task Refresh()
{
Classes = db.Class.ToList();
await Task.Delay(1000);
Grid.Refresh();
StateHasChanged();
}
And I call it like this:
await Refresh();
This mostly works, but sometimes the data doesn't refresh, or it appears and it dissapears in less then a second. Then I need to either refresh the page or pretend I am making a new item, so that the method is called, and it always works then. What else should I try?