diff --git a/src/dashboard/Synapse.Dashboard/Components/ResourceEditor/ResourceEditor.razor b/src/dashboard/Synapse.Dashboard/Components/ResourceEditor/ResourceEditor.razor
index 08b2de31..8b74ca56 100644
--- a/src/dashboard/Synapse.Dashboard/Components/ResourceEditor/ResourceEditor.razor
+++ b/src/dashboard/Synapse.Dashboard/Components/ResourceEditor/ResourceEditor.razor
@@ -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);
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))
@@ -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)
{
@@ -178,7 +179,6 @@
{
this.isSaving = saving;
if (this.textBasedEditor != null) this.textBasedEditor.UpdateOptions(new EditorUpdateOptions() { ReadOnly = saving });
- this.StateHasChanged();
}
///
@@ -199,7 +199,7 @@
await this.SetTextEditorValueAsync();
await this.SetTextBasedEditorLanguageAsync();
}
- this.StateHasChanged();
+ this.OnStateChanged();
}
///
diff --git a/src/dashboard/Synapse.Dashboard/Components/ResourceManagement/ResourceManagementComponent.cs b/src/dashboard/Synapse.Dashboard/Components/ResourceManagement/ResourceManagementComponent.cs
index ebeff4e1..9b7a47c0 100644
--- a/src/dashboard/Synapse.Dashboard/Components/ResourceManagement/ResourceManagementComponent.cs
+++ b/src/dashboard/Synapse.Dashboard/Components/ResourceManagement/ResourceManagementComponent.cs
@@ -236,15 +236,16 @@ protected virtual Task OnShowResourceDetailsAsync(TResource resource)
/// Opens the targeted 's edition
///
/// The to edit
- 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
{
{ nameof(ResourceEditor.Resource), resource! }
};
string actionType = resource == null ? "creation" : "edition";
- return this.EditorOffCanvas.ShowAsync>(title: typeof(TResource).Name + " " + actionType, parameters: parameters);
+ await this.EditorOffCanvas.ShowAsync>(title: typeof(TResource).Name + " " + actionType);
+ await this.EditorOffCanvas.ShowAsync>(title: typeof(TResource).Name + " " + actionType, parameters: parameters);
}
}
diff --git a/src/dashboard/Synapse.Dashboard/Pages/Namespaces/List/View.razor b/src/dashboard/Synapse.Dashboard/Pages/Namespaces/List/View.razor
index 1c018dcd..20614830 100644
--- a/src/dashboard/Synapse.Dashboard/Pages/Namespaces/List/View.razor
+++ b/src/dashboard/Synapse.Dashboard/Pages/Namespaces/List/View.razor
@@ -95,15 +95,16 @@
/// Opens the targeted 's edition
///
/// The to edit
- 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
{
{ nameof(ResourceEditor.Resource), resource! },
{ nameof(ResourceEditor.IsCluster), true }
};
string actionType = resource == null ? "creation" : "edition";
- return this.EditorOffCanvas.ShowAsync>(title: typeof(Namespace).Name + " " + actionType, parameters: parameters);
+ await this.EditorOffCanvas.ShowAsync>(title: typeof(Namespace).Name + " " + actionType);
+ await this.EditorOffCanvas.ShowAsync>(title: typeof(Namespace).Name + " " + actionType, parameters: parameters);
}
}
\ No newline at end of file
diff --git a/src/dashboard/Synapse.Dashboard/StatefulComponent.cs b/src/dashboard/Synapse.Dashboard/StatefulComponent.cs
index 25d051d1..8f55e385 100644
--- a/src/dashboard/Synapse.Dashboard/StatefulComponent.cs
+++ b/src/dashboard/Synapse.Dashboard/StatefulComponent.cs
@@ -61,9 +61,9 @@ protected override async Task OnInitializedAsync()
/// Patches the component fields after a change
///
/// The patch to apply
- protected void OnStateChanged(Action patch)
+ protected void OnStateChanged(Action? patch = null)
{
- patch((TComponent)this);
+ if (patch != null) patch((TComponent)this);
this.shouldRender = true;
this.StateHasChanged();
}