Skip to content

Commit

Permalink
Fixes #613
Browse files Browse the repository at this point in the history
Fixes: COntentAlwaysRender was ignored after closing modal
  • Loading branch information
jbomhold3 committed Aug 10, 2024
1 parent 374e394 commit a333d92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/BlazorStrap/Shared/Components/Modal/BSModalBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public override bool Shown
/// <summary>
/// Using this will allow you to manually control the modal show/hide state. It ignores all forwarded events and only responds to the Show/Hide methods.
/// </summary>
[Parameter] public bool IsManual { get; set; }
[Parameter] public bool IsManual { get; set; }

#region Render props
protected abstract string? LayoutClass { get; }
Expand Down Expand Up @@ -179,7 +179,8 @@ public override async Task HideAsync()
}

CanRefresh = true;
ShouldRenderContent = false;
if(!ContentAlwaysRendered)
ShouldRenderContent = false;


await InvokeAsync(StateHasChanged);
Expand Down Expand Up @@ -227,6 +228,7 @@ public override async Task ShowAsync()
await InvokeAsync(StateHasChanged);
taskSource.SetResult(true);
await OnShown.InvokeAsync(this);

};

_eventQue.Enqueue(new EventQue { TaskSource = taskSource, Func = func});
Expand Down
6 changes: 4 additions & 2 deletions src/BlazorStrap/wwwroot/blazorstrapinterop.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ export async function showModal(modal, dotnet) {
await openModals.forEach(async openModal => {
//if data-bs-manual is true then do not hide the modal
if (openModal.getAttribute("data-bs-manual") != "true") {
dotnet.invokeMethodAsync('InvokeEventAsync', "javascript", openModal.getAttribute("data-blazorstrap"), "hide", "");
openModal.classList.remove("show");
if (openModal.getAttribute("data-blazorstrap") != model.getAttribute("data-blazorstrap") ) {
dotnet.invokeMethodAsync('InvokeEventAsync', "javascript", openModal.getAttribute("data-blazorstrap"), "hide", "");
openModal.classList.remove("show");
}
}
});
await new Promise(resolve => setTimeout(resolve, 75));
Expand Down

0 comments on commit a333d92

Please sign in to comment.