Skip to content

Commit

Permalink
Fix state issue opps....
Browse files Browse the repository at this point in the history
  • Loading branch information
jbomhold3 committed May 10, 2023
1 parent 8dd00bd commit a8f9b55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

private void OnChange(DataRequest dataRequest)
{
Console.WriteLine(dataRequest.Descending);
_count = _model.DataSet.Count();
if (dataRequest.FilterColumnProperty != null && dataRequest.Filter != null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BlazorStrap/BlazorStrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://blazorstrap.io/</PackageProjectUrl>
<RepositoryUrl>https://github.com/chanan/BlazorStrap</RepositoryUrl>
<RootNamespace>BlazorStrap</RootNamespace>
<PackageVersion>5.1.102</PackageVersion> <!--Next Use 5.1.103-Preview1-->
<PackageVersion>5.1.102.50923</PackageVersion> <!--Next Use 5.1.103-Preview1-->
</PropertyGroup>

<ItemGroup>
Expand Down
14 changes: 6 additions & 8 deletions src/BlazorStrap/Shared/Components/Common/BSCollapseBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,18 @@ public override async Task ShowAsync()
{
await BlazorStrapService.Interop.AnimateCollapseAsync(_objectRef, MyRef, DataId, true);
}
await BlazorStrapService.Interop.WaitForTransitionEnd(MyRef, 400);
await Task.Delay(50);
await BlazorStrapService.Interop.WaitForTransitionEnd(MyRef, 500);
await BlazorStrapService.Interop.SetStyleAsync(MyRef, "height", "");
}
}
catch //Animation failed cleaning up
{
}
_shown = true;
CanRefresh = true;
await InvokeAsync(StateHasChanged);
_ = Task.Run(() => { _ = OnShown.InvokeAsync(this); });
taskSource.SetResult(true);
CanRefresh = true;
};
_eventQue.Add(new EventQue { TaskSource = taskSource, Func = func});

Expand All @@ -122,7 +121,6 @@ public override async Task ShowAsync()

public override async Task HideAsync()
{

if (!_shown) return ;
_ = Task.Run(() => { _ = OnHide.InvokeAsync(this); });
//Kick off to event que
Expand All @@ -138,24 +136,24 @@ public override async Task HideAsync()
if (IsHorizontal)
{
await BlazorStrapService.Interop.AnimateHorizontalCollapseAsync(_objectRef, MyRef, DataId, false);
await BlazorStrapService.Interop.WaitForTransitionEnd(MyRef, 400);
await BlazorStrapService.Interop.WaitForTransitionEnd(MyRef, 500);
}
else
{
await BlazorStrapService.Interop.AnimateCollapseAsync(_objectRef, MyRef, DataId, false);
await BlazorStrapService.Interop.WaitForTransitionEnd(MyRef, 400);
await BlazorStrapService.Interop.WaitForTransitionEnd(MyRef, 500);
}
}
}
catch //Animation failed cleaning up
{
}

CanRefresh = true;
_shown = false;
await InvokeAsync(StateHasChanged);
_ = Task.Run(() => { _ = OnHidden.InvokeAsync(this); });
taskSource.SetResult(true);
CanRefresh = true;
};

_eventQue.Add(new EventQue { TaskSource = taskSource, Func = func });
Expand Down Expand Up @@ -186,7 +184,6 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!firstRender)
{
_hasRendered = true;
if (_eventQue.Count > 0)
{
var eventItem = _eventQue.First();
Expand All @@ -199,6 +196,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
}
else
{
_hasRendered = true;
_objectRef = DotNetObjectReference.Create(this);
}
}
Expand Down

0 comments on commit a8f9b55

Please sign in to comment.