Skip to content

Commit 35b9672

Browse files
authored
feat: update to bit 9.6.0 #70 (#71)
1 parent c22ae31 commit 35b9672

File tree

196 files changed

+3178
-1128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+3178
-1128
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
}
2525
},
2626
"forwardPorts": [
27-
4104,
27+
4296,
2828
5000,
29-
5206
29+
5148
3030
],
3131
"features": {
3232
"ghcr.io/devcontainers/features/node": {},

.github/workflows/cd.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ jobs:
3838
- name: Update core appsettings.json
3939
uses: devops-actions/variable-substitution@v1.2
4040
with:
41-
files: 'src/Shared/appsettings.json, src/Client/Bit.TemplatePlayground.Client.Core/appsettings.json, src/Client/Bit.TemplatePlayground.Client.Web/appsettings.json'
41+
files: 'src/**/appsettings*json'
4242
env:
43+
WebAppRender.BlazorMode: 'BlazorWebAssembly'
4344
ServerAddress: ${{ env.SERVER_ADDRESS }}
4445

4546
- name: Install wasm
@@ -95,19 +96,8 @@ jobs:
9596
with:
9697
files: 'appsettings.json'
9798
env:
98-
ConnectionStrings_SqlServerConnectionString: ${{ secrets.DB_CONNECTION_STRING }}
99-
DataProtectionCertificatePassword: ${{ secrets.API_DATA_PROTECTION_CERTIFICATE_PASSWORD }}
100-
101-
- name: Delete DataProtectionCertificate.pfx
102-
run: |
103-
rm DataProtectionCertificate.pfx
104-
105-
- name: Extract data protection certificate from env
106-
uses: timheuer/base64-to-file@v1.2
107-
with:
108-
fileDir: './'
109-
fileName: 'DataProtectionCertificate.pfx'
110-
encodedString: ${{ secrets.API_DATA_PROTECTION_CERTIFICATE_FILE_BASE64 }}
99+
ConnectionStrings.SqlServerConnectionString: ${{ secrets.DB_CONNECTION_STRING }}
100+
Identity.JwtIssuerSigningKeySecret: ${{ secrets.Jwt_Issuer_Signing_Key_Secret }}
111101

112102
- name: Run migrations
113103
run: |
@@ -145,7 +135,7 @@ jobs:
145135
- name: Update core appsettings.json
146136
uses: devops-actions/variable-substitution@v1.2
147137
with:
148-
files: 'src\Shared\appsettings.json, src\Client\Bit.TemplatePlayground.Client.Core\appsettings.json, src\Client\Bit.TemplatePlayground.Client.Windows\appsettings.json'
138+
files: 'src\**\appsettings*json'
149139
env:
150140
ServerAddress: ${{ env.SERVER_ADDRESS }}
151141
WindowsUpdate.FilesUrl: 'https://use-your-api-server-url-here.com/windows' # Deploy the published Windows application files to your desired hosting location and use the host url here.
@@ -194,7 +184,7 @@ jobs:
194184
- name: Update core appsettings.json
195185
uses: devops-actions/variable-substitution@v1.2
196186
with:
197-
files: 'src/Shared/appsettings.json, src/Client/Bit.TemplatePlayground.Client.Core/appsettings.json, src/Client/Bit.TemplatePlayground.Client.Maui/appsettings.json'
187+
files: 'src/**/appsettings*json'
198188
env:
199189
ServerAddress: ${{ env.SERVER_ADDRESS }}
200190

@@ -243,7 +233,7 @@ jobs:
243233
- name: Update core appsettings.json
244234
uses: devops-actions/variable-substitution@v1.2
245235
with:
246-
files: 'src/Shared/appsettings.json, src/Client/Bit.TemplatePlayground.Client.Core/appsettings.json, src/Client/Bit.TemplatePlayground.Client.Maui/appsettings.json'
236+
files: 'src/**/appsettings*json'
247237
env:
248238
ServerAddress: ${{ env.SERVER_ADDRESS }}
249239

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: dotnet build Bit.TemplatePlayground.sln -c Release
3232

3333
- name: Install Playwright
34-
run: pwsh src/Tests/bin/Debug/net8.0/playwright.ps1 install --with-deps
34+
run: pwsh src/Tests/bin/Debug/net9.0/playwright.ps1 install --with-deps
3535

3636
- name: Test
3737
id: test

src/Client/Bit.TemplatePlayground.Client.Core/Bit.TemplatePlayground.Client.Core.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818

1919
<PackageReference Include="Bit.Butil" />
2020
<PackageReference Include="Bit.BlazorUI" />
21+
<PackageReference Include="Bit.BlazorES2019" />
2122
<PackageReference Include="Bit.BlazorUI.Icons" />
2223
<PackageReference Include="Bit.BlazorUI.Assets" />
24+
<PackageReference Include="Fido2.Models" />
2325
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" />
24-
<PackageReference Include="Bit.BlazorUI.Extras" />
26+
<PackageReference Include="Bit.BlazorUI.Extras" />
2527
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" />
2628
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" />
2729
<PackageReference Include="Microsoft.AspNetCore.Components.Web" />

src/Client/Bit.TemplatePlayground.Client.Core/Components/AppComponentBase.cs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected CancellationToken CurrentCancellationToken
6565
}
6666
}
6767

68-
protected bool InPrerenderSession => AppPlatform.IsBlazorHybrid is false && JSRuntime.IsInitialized() is false;
68+
protected bool InPrerenderSession => AppPlatform.IsBlazorHybrid is false && RendererInfo.IsInteractive is false;
6969

7070
protected sealed override void OnInitialized()
7171
{
@@ -86,7 +86,7 @@ protected sealed override async Task OnInitializedAsync()
8686
}
8787

8888
/// <summary>
89-
/// Replacement for <see cref="OnInitializedAsync"/> which catches all possible exceptions in order to prevent app crash.
89+
/// A safer alternative to `<see cref="OnInitializedAsync"/>` that catches and handles all exceptions internally, preventing them from triggering the application's error boundary.
9090
/// </summary>
9191
protected virtual Task OnInitAsync()
9292
{
@@ -108,7 +108,7 @@ protected sealed override async Task OnParametersSetAsync()
108108
}
109109

110110
/// <summary>
111-
/// Replacement for <see cref="OnParametersSetAsync"/> which catches all possible exceptions in order to prevent app crash.
111+
/// A safer alternative to `<see cref="OnParametersSetAsync"/>` that catches and handles all exceptions internally, preventing them from triggering the application's error boundary.
112112
/// </summary>
113113
protected virtual Task OnParamsSetAsync()
114114
{
@@ -134,7 +134,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
134134
}
135135

136136
/// <summary>
137-
/// Method invoked after first time the component has been rendered.
137+
/// This method is executed only during the initial render of the component.
138+
/// It ensures that all potential exceptions are handled gracefully, preventing them from triggering the application's error boundary.
138139
/// </summary>
139140
protected virtual Task OnAfterFirstRenderAsync()
140141
{
@@ -143,7 +144,7 @@ protected virtual Task OnAfterFirstRenderAsync()
143144

144145

145146
/// <summary>
146-
/// Executes passed action while catching all possible exceptions to prevent app crash.
147+
/// Executes passed action that catches and handles all exceptions internally, preventing them from triggering the application's error boundary.
147148
/// </summary>
148149
public virtual Action WrapHandled(Action action,
149150
[CallerLineNumber] int lineNumber = 0,
@@ -164,7 +165,7 @@ public virtual Action WrapHandled(Action action,
164165
}
165166

166167
/// <summary>
167-
/// Executes passed action while catching all possible exceptions to prevent app crash.
168+
/// Executes passed action that catches and handles all exceptions internally, preventing them from triggering the application's error boundary.
168169
/// </summary>
169170
public virtual Action<T> WrapHandled<T>(Action<T> func,
170171
[CallerLineNumber] int lineNumber = 0,
@@ -185,7 +186,7 @@ public virtual Action<T> WrapHandled<T>(Action<T> func,
185186
}
186187

187188
/// <summary>
188-
/// Executes passed function while catching all possible exceptions to prevent app crash.
189+
/// Executes passed action that catches and handles all exceptions internally, preventing them from triggering the application's error boundary.
189190
/// </summary>
190191
public virtual Func<Task> WrapHandled(Func<Task> func,
191192
[CallerLineNumber] int lineNumber = 0,
@@ -206,7 +207,7 @@ public virtual Func<Task> WrapHandled(Func<Task> func,
206207
}
207208

208209
/// <summary>
209-
/// Executes passed function while catching all possible exceptions to prevent app crash.
210+
/// Executes passed action that catches and handles all exceptions internally, preventing them from triggering the application's error boundary.
210211
/// </summary>
211212
public virtual Func<T, Task> WrapHandled<T>(Func<T, Task> func,
212213
[CallerLineNumber] int lineNumber = 0,
@@ -227,7 +228,7 @@ public virtual Func<T, Task> WrapHandled<T>(Func<T, Task> func,
227228
}
228229

229230
/// <summary>
230-
/// Cancells running codes inside current component.
231+
/// Terminates any ongoing operations within the current component.
231232
/// </summary>
232233
protected async Task Abort()
233234
{
@@ -245,8 +246,15 @@ protected async Task Abort()
245246

246247
public async ValueTask DisposeAsync()
247248
{
248-
cts?.Dispose();
249-
cts = null;
249+
if (cts != null)
250+
{
251+
using var currentCts = cts;
252+
cts = null;
253+
if (currentCts.IsCancellationRequested is false)
254+
{
255+
await currentCts.CancelAsync();
256+
}
257+
}
250258

251259
await PrerenderStateService.DisposeAsync();
252260

src/Client/Bit.TemplatePlayground.Client.Core/Components/AppDataAnnotationsValidator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ namespace Bit.TemplatePlayground.Client.Core.Components;
99

1010
/// <summary>
1111
/// To implement forms where each error is displayed according to the language chosen by the user, you can use the <see cref="DtoResourceTypeAttribute"/>
12-
/// on the corresponding class instead of using `ErrorResourceType` on each property. Check out <see cref="SignUpRequestDto"/> for an example.
12+
/// on the corresponding class instead of using `<see cref="ValidationAttribute.ErrorResourceType" />` on each property. Check out <see cref="SignUpRequestDto.UserName"/> for an example.
1313
/// However, you need to use <see cref="AppDataAnnotationsValidator"/> instead of <see cref="DataAnnotationsValidator"/> in Blazor EditForms for this method to work.
14+
/// Additionally, this provides the `<see cref="DisplayErrors(ResourceValidationException)"/>` method, which assists in displaying dynamic error messages.
1415
/// </summary>
1516
public partial class AppDataAnnotationsValidator : AppComponentBase
1617
{

src/Client/Bit.TemplatePlayground.Client.Core/Components/ClientAppCoordinator.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ protected override async Task OnInitAsync()
3737
{
3838
unsubscribe = PubSubService.Subscribe(ClientPubSubMessages.NAVIGATE_TO, async (uri) =>
3939
{
40-
NavigationManager.NavigateTo(uri!.ToString()!);
40+
var uriValue = uri?.ToString()!;
41+
var replace = uriValue.Contains("replace=true", StringComparison.InvariantCultureIgnoreCase);
42+
var forceLoad = uriValue.Contains("forceLoad=true", StringComparison.InvariantCultureIgnoreCase);
43+
NavigationManager.NavigateTo(uriValue.Replace("replace=true", "", StringComparison.InvariantCultureIgnoreCase).Replace("forceLoad=true", "", StringComparison.InvariantCultureIgnoreCase).TrimEnd('&'), forceLoad, replace);
4144
});
4245
TelemetryContext.TimeZone = await jsRuntime.GetTimeZone();
4346
TelemetryContext.Culture = CultureInfo.CurrentCulture.Name;
@@ -52,7 +55,7 @@ protected override async Task OnInitAsync()
5255
NavigationManager.LocationChanged += NavigationManager_LocationChanged;
5356
AuthManager.AuthenticationStateChanged += AuthenticationStateChanged;
5457
SubscribeToSignalREventsMessages();
55-
await PropagateUserId(firstRun: true, AuthenticationStateTask);
58+
await PropagateAuthState(firstRun: true, AuthenticationStateTask);
5659
}
5760

5861
await base.OnInitAsync();
@@ -69,7 +72,7 @@ private void NavigationManager_LocationChanged(object? sender, LocationChangedEv
6972
/// This code manages the association of a user with sensitive services, such as SignalR, push notifications, App Insights, and others,
7073
/// ensuring the user is correctly set or cleared as needed.
7174
/// </summary>
72-
public async Task PropagateUserId(bool firstRun, Task<AuthenticationState> task)
75+
public async Task PropagateAuthState(bool firstRun, Task<AuthenticationState> task)
7376
{
7477
try
7578
{
@@ -111,7 +114,7 @@ public async Task PropagateUserId(bool firstRun, Task<AuthenticationState> task)
111114

112115
private void AuthenticationStateChanged(Task<AuthenticationState> task)
113116
{
114-
_ = PropagateUserId(firstRun: false, task);
117+
_ = PropagateAuthState(firstRun: false, task);
115118
}
116119

117120
private void SubscribeToSignalREventsMessages()

src/Client/Bit.TemplatePlayground.Client.Core/Components/Layout/AppDiagnosticModal.razor

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,46 @@
5252
</BitDropdown>
5353
<BitButton IconOnly
5454
OnClick="HandleOnSortClick"
55+
Title="Sort"
5556
Color="BitColor.SecondaryBackground"
5657
IconName="@(isDescendingSort? BitIconName.SortDown: BitIconName.SortUp)" />
5758
<BitButton OnClick="ClearLogs"
59+
title="Clear lgos"
5860
Color="BitColor.Info"
5961
Variant="BitVariant.Outline">Clear logs</BitButton>
6062
<BitButton IconOnly
6163
OnClick="ReloadLogs"
64+
Title="Reload logs"
6265
IconName="@BitIconName.Refresh"
6366
Color="BitColor.SecondaryBackground" />
6467
<BitButton IconOnly
6568
OnClick="ThrowTestException"
69+
Title="Throw test error"
6670
IconName="@BitIconName.Error"
6771
Color="BitColor.SecondaryBackground" />
68-
<BitButton IconOnly
72+
<BitButton IconOnly AutoLoading
6973
OnClick="CallDiagnosticsApi"
74+
Title="Call Diag API"
7075
Color="BitColor.SecondaryBackground"
7176
IconName="@BitIconName.DiagnosticDataViewerApp" />
77+
<BitButton IconOnly AutoLoading
78+
OnClick="OpenDevTools"
79+
Title="Open dev tools"
80+
Color="BitColor.SecondaryBackground"
81+
IconName="@BitIconName.DeveloperTools" />
7282
@if (AppPlatform.IsBrowser is false)
7383
{
7484
<BitButton IconOnly
7585
OnClick="CallGC"
86+
Title="Call GC"
7687
Color="BitColor.SecondaryBackground"
7788
IconName="@BitIconName.RecycleBin" />
7889
}
90+
<BitButton IconOnly AutoLoading
91+
OnClick="ClearCache"
92+
Title="Clear cache"
93+
Color="BitColor.SecondaryBackground"
94+
IconName="@BitIconName.Clear" />
7995
</BitStack>
8096

8197
<BitBasicList @ref="logStackRef"

0 commit comments

Comments
 (0)