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

Enable UseDotvvmSerializationForStaticCommandArguments by default #1898

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
@@ -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
Loading