-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Observed behavior
Following is my code:
const clientName = 'my-client';
await OpenFeature.setContext(clientName, { user: "mike" });
OpenFeature.setProvider(
clientName,
new FlagdWebProvider({
host: "localhost",
port: 8013,
tls: false,
})
);
const client = OpenFeature.getClient(clientName);
client.addHandler(ProviderEvents.Ready, () => {
const flag = client.getBooleanValue("my-flag", false);
const flagElm = document.querySelector('#flag-value');
if (flagElm) {
flagElm.innerHTML = flag.toString();
}
});and flags.json
{
"$schema": "https://flagd.dev/schema/v0/flags.json",
"flags": {
"my-flag": {
"state": "ENABLED",
"variants": {
"on": true,
"off": false
},
"defaultVariant": "off",
"targeting": {
"if": [
{
"===": [
{
"var": "user"
},
"mike"
]
},
"on",
"off"
]
}
}
}
}Expected Behavior
I have set the named context and provider, and created a named client, if the context is working, I should get the on variant, but I got off, after open DevTools, the context didn't pass to flagd service.
When I use the empty name for context, provider, and client, the context is passed to flagd service as my expectation.
So I guess the named context is currently not working.
Steps to reproduce
I have a reproduced repo
https://github.com/wellwind/flagd-context-demo
in src/main.ts,if I set clientName to any non empty name, the flag result will be false, when I set clientName to '', I can get the true result.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working