Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.8.9 #183

Merged
merged 8 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.8.9 - 2024-07-13

### 🔇 Remove logs

- Remove the loggings

### 🐛 Fix bugs

- Better manage to the lifecycle cancellation token source
- Prevent a null reference on CmJsInterop: don't nullify it on component disposal

## 0.8.8 - 2024-06-16

### ⬆️ Upgrade dependencies
Expand Down
2 changes: 1 addition & 1 deletion CodeMirror6/CodeMirror6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>GaelJ.BlazorCodeMirror6</AssemblyName>
<IsPackable>true</IsPackable>
<PackageId>GaelJ.BlazorCodeMirror6</PackageId>
<Version>0.8.8</Version>
<Version>0.8.9</Version>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
47 changes: 32 additions & 15 deletions CodeMirror6/CodeMirror6WrapperInternal.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public partial class CodeMirror6WrapperInternal : ComponentBase, IAsyncDisposabl
internal CodeMirrorConfiguration Config = null!;
private bool shouldRender = true;
private bool IsCodeMirrorInitialized;
private readonly CancellationTokenSource LifeCycleCancellationTokenSource = new();
private CancellationTokenSource LifeCycleCancellationTokenSource = new();

/// <summary>
/// Life-cycle method invoked when the component is initialized.
Expand Down Expand Up @@ -335,20 +335,38 @@ protected override async Task OnAfterRenderAsync(bool firstRender)

private async Task InitializeJsInterop()
{
if (CmJsInterop is null) {
Logger.LogDebug("Initializing CodeMirror JS Interop with id {id}", Setup.Id);
if (LifeCycleCancellationTokenSource.IsCancellationRequested) return;
CmJsInterop = new CodeMirrorJsInterop(JSRuntime, this);
if (LifeCycleCancellationTokenSource.IsCancellationRequested) return;
if (!await CmJsInterop.PropertySetters.InitCodeMirror()) return;
if (GetMentionCompletions is not null) {
var mentionCompletions = await GetMentionCompletions();
if (!await CmJsInterop.PropertySetters.SetMentionCompletions(mentionCompletions)) return;
if (CmJsInterop is null || !IsCodeMirrorInitialized) {
try {
try {
LifeCycleCancellationTokenSource.Cancel();
}
catch (ObjectDisposedException) {
return;
}
LifeCycleCancellationTokenSource = new();

var token = LifeCycleCancellationTokenSource.Token;
Logger.LogInformation("Initializing CodeMirror JS Interop with id {id}...", Setup.Id);
if (token.IsCancellationRequested) return;
CmJsInterop = new CodeMirrorJsInterop(JSRuntime, this);

if (token.IsCancellationRequested) return;
if (!await CmJsInterop.PropertySetters.InitCodeMirror()) return;

if (GetMentionCompletions is not null) {
var mentionCompletions = await GetMentionCompletions();
if (token.IsCancellationRequested) return;
if (!await CmJsInterop.PropertySetters.SetMentionCompletions(mentionCompletions)) return;
}
if (token.IsCancellationRequested) return;
IsCodeMirrorInitialized = true;
await InvokeAsync(StateHasChanged);
await OnParametersSetAsync();
}
catch (OperationCanceledException) {
}
catch (ObjectDisposedException) {
}
if (LifeCycleCancellationTokenSource.IsCancellationRequested) return;
IsCodeMirrorInitialized = true;
await InvokeAsync(StateHasChanged);
await OnParametersSetAsync();
}
}

Expand Down Expand Up @@ -519,7 +537,6 @@ public async ValueTask DisposeAsync()
catch (ObjectDisposedException) {}
if (CmJsInterop?.IsJSReady == true)
await CmJsInterop.DisposeAsync();
CmJsInterop = null;
try {
LinterCancellationTokenSource.Cancel();
LinterCancellationTokenSource.Dispose();
Expand Down
2 changes: 1 addition & 1 deletion Examples.BlazorServer/Examples.BlazorServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>0.8.8</Version>
<Version>0.8.9</Version>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<Version>0.8.8</Version>
<Version>0.8.9</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Sentry.AspNetCore" Version="4.7.0" />
Expand Down
2 changes: 1 addition & 1 deletion Examples.BlazorWasm/Examples.BlazorWasm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<Version>0.8.8</Version>
<Version>0.8.9</Version>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser-wasm" />
Expand Down
2 changes: 1 addition & 1 deletion Examples.Common/Examples.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<Version>0.8.8</Version>
<Version>0.8.9</Version>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
Expand Down
9 changes: 7 additions & 2 deletions NEW_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### ⬆️ Upgrade dependencies
### 🔇 Remove logs

- Update nuget packages
- Remove the loggings

### 🐛 Fix bugs

- Better manage to the lifecycle cancellation token source
- Prevent a null reference on CmJsInterop: don't nullify it on component disposal
Loading