Closed BrandonHigbee closed 5 months ago
In further testing if I update my interval to fetch the user then I see updates from the server. I was under the impression that the polling mechanism kicked off by await experiment.start(user);
would handle this, otherwise it is not clear what the polling is doing.
const fetchFlags = () => {
experiment
.fetch()
.then(() => {
const evaluatedFlags = experiment.all();
console.log('evaluatedFlags', evaluatedFlags);
setFlags((prev) => ({ ...prev, ...evaluatedFlags }));
})
.catch((error: Error) => {
setError(error);
});
};
@BrandonHigbee Hey thanks for submitting this. Yes you're right, the poller is just for local evaluation flags, not remote evaluation.
To re-evaluate for remote evaluation, you will need to call fetch()
manually. If you dont use local evaluation you can turn of the polling for local evaluation flag configurations from calling start using pollOnStart: false
in the config.
version:
"@amplitude/experiment-js-client": "^1.10.2"
goal: when I update an Amplitude feature flag from the Experiment user interface I want my app to update without needing user input such as refreshing the page
observed behavior: flags never update until I refresh the page (it seems like it may be tied to the experiment assignment event which doesnt get emitted afaik until the sdk is reinitialized?)
Example react code:
Log output:
This repeats forever regardless of the changes I make in amplitude. Any help is appreciated. If there is an easier way to subscribe to flag changes then please advise :)