Skip to content

Commit

Permalink
fix: change use clear all data
Browse files Browse the repository at this point in the history
  • Loading branch information
Qinyouzeng committed Jun 20, 2024
1 parent 4c0fc3f commit 41a55ee
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Web/Masa.Tsc.Web.Admin.Rcl/Pages/App/Index.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public partial class Index

private string? spanId;
private DateTime? logTime;
private bool firstLoaded = false;
private NameValueCollection? values;
private bool dataLoading = false;

Expand Down Expand Up @@ -164,8 +163,7 @@ private async Task UserChange(Guid userId)
{
if (_userId == userId)
return;
currentLog = default;
currentTrace = default;
ClearData();
_userId = userId;
if (roles == null)
roles = await ApiCaller.UserService.GetUserRolesAsync(userId);
Expand All @@ -191,8 +189,7 @@ private async Task UserChange(Guid userId)
foreach (var key in claims.Keys)
{
this.claims.Add(key, claims[key]);
}
data.Clear();
}
await LoadTrace();
}

Expand Down Expand Up @@ -301,6 +298,18 @@ private async Task SetDeviceModel(TraceResponseDto? trace)
}
}

private void ClearData()
{
user = null;
currentLog = null;
currentTrace = null;
traceLines.Clear();
firstTrace = null;
phoneModel = null;
claims.Clear();
data.Clear();
}

private void SetTraceData(IEnumerable<TraceResponseDto> traces)
{
if (traces == null || !traces.Any()) return;
Expand Down

0 comments on commit 41a55ee

Please sign in to comment.