Hi,
We believe we have found two bugs in the GetFeatureToggleById client action in Template_FT_ClientFS.
1. CheckIsActive javascript: NeedsResync not set if FT_Array is empty.
This script starts with (omitted certain parts for brevity): if ($parameters.FT_Array === "" || ...) { $public.Logger.log("...", "Empty Feature Toggle JSON. ... Demanding a Resync.") $resolve(); }
It explicitly mentions "Demanding a Resync.", but the output parameter NeedsResync is not set to True. We believe here, the following needs to be added, so that a resync is done if the feature toggles have not been synced yet:
$parameters.NeedsResync = true;
2. 'Old' feature toggle state returned if feature toggles refreshed because they expired
In the above code, the 'ReSync' If-condition returns True if either:
In both cases we sync the feature toggles.
However, we only run CheckIfIsActive again in the first case. If we synced because the feature toggles were expired, then we go straight to the IsOn assign. That means that this client action will return the OLD value of the requested feature toggle, not the refreshed value.
We suggest to change this flow to:
So, always run CheckIfIsActive again after a sync, because we need the new, updated, value of the feature toggle.
Changes in attachment as well.
Kind regards,
Steven
Hey Steven,
thanks for sharing this.
You are right, the logic does not make sense on this part. thanks for sharing the solution. I've just released the fix.
Cheers!