Skip to content

Commit

Permalink
Enable UseDotvvmSerializationForStaticCommandArguments by default
Browse files Browse the repository at this point in the history
resolves #809
  • Loading branch information
exyi committed Dec 20, 2024
1 parent 1fff36f commit de031a6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;

Expand Down Expand Up @@ -40,15 +41,16 @@ public class DotvvmExperimentalFeaturesConfiguration
[JsonPropertyName("knockoutDeferUpdates")]
public DotvvmFeatureFlag KnockoutDeferUpdates { get; private set; } = new DotvvmFeatureFlag("KnockoutDeferUpdates");


[JsonPropertyName("useDotvvmSerializationForStaticCommandArguments")]
public DotvvmGlobalFeatureFlag UseDotvvmSerializationForStaticCommandArguments { get; private set; } = new DotvvmGlobalFeatureFlag("UseDotvvmSerializationForStaticCommandArguments");
[Obsolete("This is now enabled by default and can only be disabled by overriding services in IServiceCollection (create StaticCommandExecutor with different jsonOptions argument)", true)]
public DotvvmGlobalFeatureFlag? UseDotvvmSerializationForStaticCommandArguments => null;

public void Freeze()
{
LazyCsrfToken.Freeze();
ServerSideViewModelCache.Freeze();
ExplicitAssemblyLoading.Freeze();
UseDotvvmSerializationForStaticCommandArguments.Freeze();
}
}

Expand Down
11 changes: 1 addition & 10 deletions src/Framework/Framework/Hosting/StaticCommandExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,7 @@ public StaticCommandExecutor(IStaticCommandServiceLoader serviceLoader, IDotvvmJ
this.viewModelProtector = viewModelProtector;
this.validator = validator;
this.configuration = configuration;
if (configuration.ExperimentalFeatures.UseDotvvmSerializationForStaticCommandArguments.Enabled)
{
this.jsonOptions = jsonOptions.ViewModelJsonOptions;
}
else
{
this.jsonOptions = new JsonSerializerOptions(DefaultSerializerSettingsProvider.Instance.SettingsHtmlUnsafe) {
WriteIndented = configuration.Debug
};
}
this.jsonOptions = jsonOptions.ViewModelJsonOptions;
}
#pragma warning restore CS0618

Expand Down
2 changes: 0 additions & 2 deletions src/Framework/Testing/DotvvmTestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public static void RegisterMockServices(IServiceCollection services)

private static Lazy<DotvvmConfiguration> _defaultConfig = new Lazy<DotvvmConfiguration>(() => {
var config = CreateConfiguration();
config.ExperimentalFeatures.UseDotvvmSerializationForStaticCommandArguments.Enable();
config.RouteTable.Add("TestRoute", "TestRoute", "TestView.dothtml");
config.Diagnostics.Apply(config);
config.Freeze();
Expand All @@ -108,7 +107,6 @@ public static void RegisterMockServices(IServiceCollection services)

private static Lazy<DotvvmConfiguration> _debugConfig = new Lazy<DotvvmConfiguration>(() => {
var config = CreateConfiguration();
config.ExperimentalFeatures.UseDotvvmSerializationForStaticCommandArguments.Enable();
config.RouteTable.Add("TestRoute", "TestRoute", "TestView.dothtml");
config.Debug = true;
config.Diagnostics.Apply(config);
Expand Down
1 change: 0 additions & 1 deletion src/Samples/Common/DotvvmStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public void Configure(DotvvmConfiguration config, string applicationPath)
{
config.DefaultCulture = "en-US";
}
config.ExperimentalFeatures.UseDotvvmSerializationForStaticCommandArguments.Enable();

AddControls(config);
AddStyles(config);
Expand Down

0 comments on commit de031a6

Please sign in to comment.