Skip to content

Commit

Permalink
[FIX] - Looping issue with OnSelect if EventCallback is used oqtane#3010
Browse files Browse the repository at this point in the history
  • Loading branch information
vnetonline committed Jul 14, 2023
1 parent a95306c commit 30ec9aa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Oqtane.Client/Modules/Controls/FileManager.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@namespace Oqtane.Modules.Controls
@using System.Threading
@using System.Threading;
@inherits ModuleControlBase
@inject IFolderService FolderService
@inject IFileService FileService
Expand Down Expand Up @@ -143,6 +143,11 @@
[Parameter]
public EventCallback<int> OnDelete { get; set; } // optional - executes a method in the calling component when a file is deleted
protected override async Task OnInitializedAsync()
{
await OnSelect.InvokeAsync(FileId);
}

protected override async Task OnParametersSetAsync()
{
// packages folder is a framework folder for uploading installable nuget packages
Expand Down Expand Up @@ -177,7 +182,7 @@
if (file != null)
{
FolderId = file.FolderId;
await OnSelect.InvokeAsync(FileId);

}
else
{
Expand Down Expand Up @@ -274,10 +279,9 @@
FileId = int.Parse((string)e.Value);
if (FileId != -1)
{
await SetImage();
await OnSelect.InvokeAsync(FileId);
}

await SetImage();
StateHasChanged();
}

Expand Down

0 comments on commit 30ec9aa

Please sign in to comment.