Skip to content

Commit

Permalink
Reduce data sent to client
Browse files Browse the repository at this point in the history
  • Loading branch information
danbopes committed Aug 15, 2023
1 parent 8092aba commit 96ba3f6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions BrotatoServer/Pages/Runs/CurrentRun.razor
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ else
[Parameter]
public string TwitchUsername { get; set; } = null!;

[Parameter]
[SupplyParameterFromQuery(Name = "debug")]
public bool Debug { get; set; } = false;

[CascadingParameter]
public TwitchUsernameStateProvider TwitchUsernameStateProvider { get; set; } = null!;
private HubConnection? HubConnection { get; set; }
Expand All @@ -85,14 +89,17 @@ else
HubConnection.On<CustomData?>(nameof(IRunHub.CustomDataUpdate), async (customData) =>
{
// Let's avoid sending this down to the client (It can be rather large with all the base64 encoded images)
await JS.InvokeVoidAsync("console.log", "Custom Data Update");
//await JS.InvokeVoidAsync("console.log", "Custom Data Update", customData);
//await JS.InvokeVoidAsync("console.log", "Custom Data Update");
if (Debug)
await JS.InvokeVoidAsync("console.log", "Custom Data Update", customData);

CustomData = customData;
await InvokeAsync(StateHasChanged);
});
HubConnection.On<RunData?>(nameof(IRunHub.RunUpdate), async (runInfo) =>
{
await JS.InvokeVoidAsync("console.log", "Current Run", runInfo);
if (Debug)
await JS.InvokeVoidAsync("console.log", "Current Run", runInfo);

if (runInfo is null)
{
Expand Down

0 comments on commit 96ba3f6

Please sign in to comment.