Skip to content

Commit

Permalink
Fixes to views
Browse files Browse the repository at this point in the history
  • Loading branch information
danbopes committed Aug 1, 2023
1 parent 66b7039 commit 5a7f0e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 1 addition & 7 deletions BrotatoServer/Hubs/RunsHub.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using BrotatoServer.Models.JSON;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace BrotatoServer.Hubs;

Expand Down Expand Up @@ -45,11 +43,7 @@ public RunsHub(CurrentRun currentRun)

public override async Task OnConnectedAsync()
{
if (_currentRun.Current != null)
{
await Clients.Caller.RunUpdate(_currentRun.Current);
}

await Clients.Caller.RunUpdate(_currentRun.Current);
await base.OnConnectedAsync();
}
}
5 changes: 4 additions & 1 deletion BrotatoServer/Pages/CurrentRun.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<PageTitle>Current Run</PageTitle>

@if (IsConnected)
@if (IsConnected && fetched)
{
@if (runInfo != null)
{
Expand All @@ -22,6 +22,7 @@
<p>Character:
<a href="https://brotato.wiki.spellsandguns.com/@niceCharName" target="_blank">
<img src="assets/items/characters/@charName/@(charName)_icon.png" />
@niceCharName
</a>
</p>

Expand Down Expand Up @@ -62,6 +63,7 @@ else
private RunInformation? runInfo;
private string? userInput;
private string? messageInput;
private bool fetched;

protected override async Task OnInitializedAsync()
{
Expand All @@ -72,6 +74,7 @@ else
hubConnection.On<RunInformation>(nameof(IRunHub.RunUpdate), (runInfo) =>
{
JS.InvokeVoidAsync("console.log", runInfo);
this.fetched = true;
this.runInfo = runInfo;
InvokeAsync(StateHasChanged);
});
Expand Down

0 comments on commit 5a7f0e7

Please sign in to comment.