Base solution for your next web application
Open Closed

Edition feature settings do not get saved when value entered is the same as default value #11449


User avatar
0
Astech created

ASP.NET CORE MVC & JQuery v12.0.1 .NET 7

Edition feature settings are not saved when setting the value back to it's default value.

Steps to reproduce:

  1. Ensure you have an edition with at least one feature with a default value (for example, enable chat with a default value of true):
  2. Edit an edition and change the setting to false.
  3. Edit the edition again and change back to true (default value). The setting does not get saved. The same applies when setting textboxes etc. back to their default values.

Having to remove the default values from AppFeatureProvider to get around this which is far from ideal. Especially when evaluating a feature setting that hasnt had a value saved against it yet.

I can debug it as far as the EditionManager: public virtual Task SetFeatureValueAsync(int editionId, string featureName, string value) { return _featureValueStore.SetEditionFeatureValueAsync(editionId, featureName, value); } But then lose the trail into ABP Source code.

Thank you


9 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    Do you mean, if you select the default value (true for example), is the previous record with value false is removed from database ? If so, this is the default behaviour of the framework.

    Or, does this cause any issues on your app ?

  • User Avatar
    0
    Astech created

    It's causing problems. If setting back to the default value, it does not get the value correctly. It's as if the IAbpZeroFeatureValueStore is caching when setting back to the default value.

    Restarting the application resolves the issue but this is obviously not a viable solution.

    Thanks

  • User Avatar
    0
    Astech created

    AppFeatureProvider: Start the app. Change the value to true, then immediately to false again. The value has now dissapeared as expected from database:

    On edit of the edition, the value still comes through as TRUE:

  • User Avatar
    0
    Astech created

    Possibly related to https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1433

    and https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1574 ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    These are very old issues, I'm not sure if they are related. I have a few questions to understand the problem.

    1. Do you use Redis or in-memory cache ?
    2. Do you have more than 1 instance of your app on production ? (I assume you get this error on production)
    3. Can you reproduce this error on devleopment ? If so, could you share the steps ?

    Thanks,

  • User Avatar
    0
    Astech created

    Thanks @ismcagdas

    I have narrowed the problem down to AbpFeatureValueStore. I have moved all methods to our own FeatureValueStore so we can debug and make any necessary changes.

    I can see that a cache is being used for the retreival of setting values and I think this may be the issue. Is there a way of disabling this or perhaps forcing a re-get of the value? And would this have any negative effects on perofrmance?

    Thanks

  • User Avatar
    0
    Astech created

    We have resolved this by moving the GetEditionValueOrNull and GetEditionValueOrNullAsync methods from the FeatureStore up into the EditionManager. We have then stopped using the cache manager and just doing a call to the repository to get the value everytime. This is getting rid of the cache manager and related issue:

    <br>

  • User Avatar
    0
    Astech created

    Changed our minds and decided to just clear the cache on feature update. This way we get instant change and keep the benefits of the cache manager normally:

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    Thanks for the update. Is it possible for you to answer these questions ?

    1. Do you use Redis or in-memory cache ?
    2. Do you have more than 1 instance of your app on production ? (I assume you get this error on production)

    Thanks,