thetanz / OpenFeature-al

OpenFeature for AL transforms Application Areas into feature toggles.

Home Page:https://theta.co.nz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fields are not hidden completely

StefanMaron opened this issue · comments

Describe the bug
When a feature is disabled, and the application are is used on a field, the field does not get hidden. Just the value is not displayed anymore

To Reproduce
Steps to reproduce the behavior:

  1. create a field with a feature application area
  2. enable the feature and verify the field is shown
  3. reload the page with ctrl+F5
  4. see the field is still there

Expected behavior
The field gets hidden completely

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
This is again maybe more a question of what I am doing wrong, or to understand how the application areas work exactly. I know you are already using this app in production so I guess you might have some more insight.
I did test this with the posthog provider. Everything else seems to be working quite well.

@StefanMaron, will it be possible to add a code?
Can you try to use this example https://github.com/vody/CustomerRewardsFFExample with your flag identifier?

with this code, if I just do what I described above, am seeing the fields being cleared but not removed.
Eventually, after a few relogs, I can see the field being gone completely.

I also tried die Condition provider. And I did not see those issues (yet) with this one.

pageextension 50100 CustomerList extends "Customer Card"
{

    layout
    {
        addlast(General)
        {
            field(Testfield1; 'MYCOOLTESTFEATURE')
            {
                ApplicationArea = MYCOOLTESTFEATURE;
            }
            field(Testfield2; 'DEMOFEATURE')
            {
                ApplicationArea = DEMOFEATURE;
            }
        }
    }

    trigger OnOpenPage()
    var
        FeatureMgt: Codeunit FeatureMgt_FF_TSL;
    begin
        if FeatureMgt.IsEnabled('MYCOOLTESTFEATURE') then
            Message('Yayyyay!');
    end;
}
codeunit 50100 "TestInstall"
{
    Subtype = Install;

    trigger OnInstallAppPerCompany();
    begin
        AddCustomFeature();
    end;

    local procedure AddCustomFeature();
    var
        PostHogProvider: Codeunit "PostHogProvider_FF_TSL";
        SecretProvider: Codeunit MySecretProvider;
        ISecretProvider: Interface "Secret Provider";
        PersonalAPIKey, ProjectID : Text;
    begin
        // App PostHog provider. It will load all available features automatically.
        ISecretProvider := SecretProvider;
        ISecretProvider.GetSecret('PostHogPersonalAPIKey', PersonalAPIKey);
        ISecretProvider.GetSecret('PostHogProjectID', ProjectID);
        if not PostHogProvider.AddProvider('SMC_POSTHOG', PersonalAPIKey, ProjectID) then
            Error(GetLastErrorText());
    end;
}

@StefanMaron, thank you for your feedback and that you are trying it out :). I will check and comment on the state.