Skip to content

Commit f8805b0

Browse files
committed
Sample cleanups
1 parent 8da7eb7 commit f8805b0

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

src/Components/Samples/BlazorUnitedApp/App.razor

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@
1717
<Routes @rendermode="InteractiveServer" />
1818
<script src="@Assets["_framework/blazor.web.js"]" autostart="false"></script>
1919
<script>
20-
Blazor.start({
21-
circuit: {
22-
reconnectionHandler: {
23-
onConnectionDown: () => displayReconectButton(),
24-
onConnectionUp: () => {
25-
// revertState();
26-
}
27-
},
28-
detailedErrors: true
29-
}
30-
});
20+
Blazor.start();
21+
// Blazor.start({
22+
// circuit: {
23+
// reconnectionHandler: {
24+
// onConnectionDown: () => (),
25+
// onConnectionUp: () => {
26+
// // revertState();
27+
// }
28+
// },
29+
// detailedErrors: true
30+
// }
31+
// });
3132
3233
function disconnect() {
3334
console.log("Disconnecting")

src/Components/Samples/BlazorUnitedApp/Data/WeatherForecast.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics;
5+
46
namespace BlazorUnitedApp.Data;
57

8+
[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")]
69
public class WeatherForecast
710
{
811
public DateOnly Date { get; set; }
@@ -12,4 +15,7 @@ public class WeatherForecast
1215
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
1316

1417
public string? Summary { get; set; }
18+
19+
private string GetDebuggerDisplay() =>
20+
$"{Date:yyyy-MM-dd}: {TemperatureC}°C ({TemperatureF}°F) - {Summary ?? "No summary"}";
1521
}

src/Components/Samples/BlazorUnitedApp/Pages/FetchData.razor

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<h1>Weather forecast</h1>
88

9-
@Guid.NewGuid().ToString()
9+
@_guid
1010

1111
<p>This component demonstrates fetching data from a service.</p>
1212

@@ -43,8 +43,11 @@ else
4343

4444
[SupplyParameterFromPersistentComponentState] public WeatherForecast[]? Forecasts { get; set; }
4545

46+
private string _guid;
47+
4648
protected override async Task OnInitializedAsync()
4749
{
50+
_guid = Guid.NewGuid().ToString();
4851
Forecasts ??= await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
4952
}
5053
}

src/Components/Samples/BlazorUnitedApp/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
.AddInteractiveWebAssemblyComponents()
1212
.AddInteractiveServerComponents(o =>
1313
{
14-
o.DisconnectedCircuitMaxRetained = 5;
15-
o.DisconnectedCircuitRetentionPeriod = TimeSpan.FromSeconds(2);
14+
o.DisconnectedCircuitMaxRetained = 0;
15+
o.DisconnectedCircuitRetentionPeriod = TimeSpan.FromSeconds(0);
1616
});
1717

1818
builder.Services.AddSingleton<WeatherForecastService>();

src/Components/Samples/BlazorUnitedApp/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"dotnetRunMessages": true,
2424
"launchBrowser": true,
2525
"launchUrl": "fetchdata",
26-
"applicationUrl": "https://localhost:7247;http://localhost:5265",
26+
"applicationUrl": "http://localhost:5265",
2727
//"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
2828
"environmentVariables": {
2929
"ASPNETCORE_ENVIRONMENT": "Development"

0 commit comments

Comments
 (0)