Skip to content

Commit 9388e90

Browse files
committed
Bug fixes
Multiple bug fixes: 1. publish pipeline publishing a nuget 2. FormControl had bug with assigning OnValueChanged parameter for dropdowns 3. Translation bugs fixed: using default translations if no active language is configured 4. JsonForm.OnSubmit was broken
1 parent a8818be commit 9388e90

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ jobs:
4444

4545
- name: Build solution
4646
run: dotnet build --no-restore --configuration Release
47-
47+
4848
- name: Pack NuGet package
49-
run: dotnet pack --no-build --configuration Release --output ./nupkg
49+
run: dotnet pack --no-build --configuration Release --output ${{ github.workspace }}/nupkg
5050

5151
- name: Publish to NuGet.org
52-
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
52+
run: dotnet nuget push ${{ github.workspace }}/nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

src/ComponentInstances/ButtonFormComponentInstanceBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public string? Text
3636

3737
if (string.IsNullOrWhiteSpace(Language))
3838
{
39-
return null;
39+
return translations?.FirstOrDefault().Value;
4040
}
4141

4242
if (translations?.ContainsKey(Language) == true)

src/Context/JsonFormTranslationContext.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using Newtonsoft.Json.Linq;
22
using Newtonsoft.Json.Schema;
3-
using Orbyss.Components.Json.Models;
43
using Orbyss.Blazor.JsonForms.Context.Interfaces;
54
using Orbyss.Blazor.JsonForms.Context.Translations;
65
using Orbyss.Blazor.JsonForms.Interpretation;
76
using Orbyss.Blazor.JsonForms.Interpretation.Interfaces;
87
using Orbyss.Blazor.JsonForms.Utils;
8+
using Orbyss.Components.Json.Models;
9+
using System.Linq;
910
using System.Text.Json;
1011

1112
namespace Orbyss.Blazor.JsonForms.Context
@@ -190,7 +191,7 @@ public string TranslateErrors(string? language, IEnumerable<ErrorType> errors, U
190191
{
191192
if (string.IsNullOrWhiteSpace(language))
192193
{
193-
return null;
194+
return translations.FirstOrDefault();
194195
}
195196

196197
return translations.FirstOrDefault(x => x.Language.Equals(language, StringComparison.OrdinalIgnoreCase));

src/FormControl.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
);
147147
}
148148

149-
return dropdownInstance.GetParameters();
149+
return result;
150150
}
151151

152152

src/JsonForm.razor

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
public string? PageTitleClass { get; set; }
4141

4242
[Parameter]
43-
public EventCallback<JToken>? OnSubmit { get; set; }
43+
public EventCallback<JToken> OnSubmit { get; set; }
4444

4545
[CascadingParameter]
4646
public string? Language { get; set; }
@@ -51,7 +51,7 @@
5151
[CascadingParameter(Name = nameof(ReadOnly))]
5252
public bool? ReadOnly { get; set; }
5353

54-
EventCallback? GetOnSubmitClickedEventCallback => OnSubmit.HasValue && OnSubmit.Value.HasDelegate
54+
EventCallback? GetOnSubmitClickedEventCallback => OnSubmit.HasDelegate
5555
? new EventCallback(this, Submit)
5656
: null;
5757

@@ -61,9 +61,9 @@
6161

6262
private Task Submit()
6363
{
64-
if (FormContext!.Validate())
64+
if (formContext!.Validate())
6565
{
66-
return OnSubmit!.Value.InvokeAsync(FormContext.GetFormData());
66+
return OnSubmit!.InvokeAsync(formContext.GetFormData());
6767
}
6868

6969
return Task.CompletedTask;
@@ -126,9 +126,14 @@
126126

127127
if (FormContext is not null)
128128
{
129-
FormContext.Instantiate(InitOptions);
129+
if(FormContext.PageCount == 0)
130+
{
131+
// Means the context is not yet instantiated
132+
FormContext.Instantiate(InitOptions);
133+
}
134+
130135
return FormContext;
131-
}
136+
}
132137

133138
var service = ServiceProvider.GetService<IJsonFormContext>();
134139
if(service is not null)

0 commit comments

Comments
 (0)