Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync().ConfigureAwait(false);
this.Store.IsSaving.Subscribe(saving => this.OnStateChanged(cmp => this.OnSavingChanged(saving)), token: this.CancellationTokenSource.Token);
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space in lambda parameter 'cmp =>' should be 'cmp =>' for consistency with other lambda expressions in the code.

Suggested change
this.Store.IsSaving.Subscribe(saving => this.OnStateChanged(cmp => this.OnSavingChanged(saving)), token: this.CancellationTokenSource.Token);
this.Store.IsSaving.Subscribe(saving => this.OnStateChanged(cmp => this.OnSavingChanged(saving)), token: this.CancellationTokenSource.Token);

Copilot uses AI. Check for mistakes.

this.Store.Resource.Subscribe(resource => this.OnStateChanged(cmp => cmp.resource = resource), token: this.CancellationTokenSource.Token);
this.Store.IsUpdating.Subscribe(updating => this.OnStateChanged(cmp => cmp.isUpdating = updating), token: this.CancellationTokenSource.Token);
this.Store.IsSaving.Subscribe(OnSavingChanged, token: this.CancellationTokenSource.Token);
this.Store.ProblemDetails.Subscribe(problemDetails => this.OnStateChanged(cmp => cmp.problemDetails = problemDetails), token: this.CancellationTokenSource.Token);
this.textEditorInput
.Throttle(TimeSpan.FromMilliseconds(300))
Expand All @@ -148,6 +148,7 @@
{
this.resource = this.Resource; // should happen in this.Store.Resource.Subscribe but prevents possible race when multiple params are set
this.Store.SetResource(this.Resource);
this.Store.SetProblemDetails(null);
}
if (this.isCluster != this.IsCluster)
{
Expand Down Expand Up @@ -178,7 +179,6 @@
{
this.isSaving = saving;
if (this.textBasedEditor != null) this.textBasedEditor.UpdateOptions(new EditorUpdateOptions() { ReadOnly = saving });
this.StateHasChanged();
}

/// <summary>
Expand All @@ -199,7 +199,7 @@
await this.SetTextEditorValueAsync();
await this.SetTextBasedEditorLanguageAsync();
}
this.StateHasChanged();
this.OnStateChanged();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,16 @@ protected virtual Task OnShowResourceDetailsAsync(TResource resource)
/// Opens the targeted <see cref="Resource"/>'s edition
/// </summary>
/// <param name="resource">The <see cref="Resource"/> to edit</param>
protected virtual Task OnShowResourceEditorAsync(TResource? resource = null)
protected virtual async Task OnShowResourceEditorAsync(TResource? resource = null)
{
if (this.EditorOffCanvas == null) return Task.CompletedTask;
if (this.EditorOffCanvas == null) return;
var parameters = new Dictionary<string, object>
{
{ nameof(ResourceEditor<TResource>.Resource), resource! }
};
string actionType = resource == null ? "creation" : "edition";
return this.EditorOffCanvas.ShowAsync<ResourceEditor<TResource>>(title: typeof(TResource).Name + " " + actionType, parameters: parameters);
await this.EditorOffCanvas.ShowAsync<ResourceEditor<TResource>>(title: typeof(TResource).Name + " " + actionType);
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate ShowAsync call detected. Line 247 calls ShowAsync without parameters, then line 248 calls it again with parameters. The first call on line 247 should be removed as it serves no purpose and may cause unexpected behavior.

Suggested change
await this.EditorOffCanvas.ShowAsync<ResourceEditor<TResource>>(title: typeof(TResource).Name + " " + actionType);

Copilot uses AI. Check for mistakes.

await this.EditorOffCanvas.ShowAsync<ResourceEditor<TResource>>(title: typeof(TResource).Name + " " + actionType, parameters: parameters);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,16 @@
/// Opens the targeted <see cref="Resource"/>'s edition
/// </summary>
/// <param name="resource">The <see cref="Resource"/> to edit</param>
protected override Task OnShowResourceEditorAsync(Namespace? resource = null)
protected override async Task OnShowResourceEditorAsync(Namespace? resource = null)
{
if (this.EditorOffCanvas == null) return Task.CompletedTask;
if (this.EditorOffCanvas == null) return;
var parameters = new Dictionary<string, object>
{
{ nameof(ResourceEditor<Namespace>.Resource), resource! },
{ nameof(ResourceEditor<Namespace>.IsCluster), true }
};
string actionType = resource == null ? "creation" : "edition";
return this.EditorOffCanvas.ShowAsync<ResourceEditor<Namespace>>(title: typeof(Namespace).Name + " " + actionType, parameters: parameters);
await this.EditorOffCanvas.ShowAsync<ResourceEditor<Namespace>>(title: typeof(Namespace).Name + " " + actionType);
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate ShowAsync call detected. Line 107 calls ShowAsync without parameters, then line 108 calls it again with parameters. The first call on line 107 should be removed as it serves no purpose and may cause unexpected behavior.

Suggested change
await this.EditorOffCanvas.ShowAsync<ResourceEditor<Namespace>>(title: typeof(Namespace).Name + " " + actionType);

Copilot uses AI. Check for mistakes.

await this.EditorOffCanvas.ShowAsync<ResourceEditor<Namespace>>(title: typeof(Namespace).Name + " " + actionType, parameters: parameters);
}
}
4 changes: 2 additions & 2 deletions src/dashboard/Synapse.Dashboard/StatefulComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ protected override async Task OnInitializedAsync()
/// Patches the component fields after a change
/// </summary>
/// <param name="patch">The patch to apply</param>
protected void OnStateChanged(Action<TComponent> patch)
protected void OnStateChanged(Action<TComponent>? patch = null)
{
patch((TComponent)this);
if (patch != null) patch((TComponent)this);
this.shouldRender = true;
this.StateHasChanged();
}
Expand Down
Loading