-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Observed behavior
We have multiple angular applications per page, and each have their own feature flags. We use web-sdk
, and implement RestClient
with using Angular HttpClient
. Then we create OpenFeatureClient like this:
{
provide: dcoFeatureFlagClient,
useFactory: async (): Promise<Client> => {
const restClient = new OpenFeatureRestClient(url); // here is HttpClient inside
const provider = new FeatureToggleProvider(restClient);
const context = await contextFactory();
return OpenFeature.setProvider(provider).getClient(context);
},
},
This creates some unexpected behavior:
- All Angular applications, uses the same HttpClient instance (from last created application).
- HttpClient and all its dependencies does not cleaned by GC, and still persists in memory heap dump until call
globalThis[Symbol(@openfeature/js-sdk/api)] = null
. - After destroying last created application, others cannot retrieve any feature flags, because HttpClient from last created application, that used by all applications is destroyed, and it throws
NG0205
error.
Expected Behavior
DO NOT create global OpenFeature instance in globalThis object. Add ability to create separate instances of OpenFeature API for each applications.
Steps to reproduce
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working