Open epatey opened 1 year ago
@epatey Thanks for the detailed filing. I've created a ticket (FSSDK-9625) to review and implement a solution.
@epatey, there have been some updates in #273 that addresses some of the rendering issues. Could you please update to the latest version and recheck if this issue still persists!
Thanks!
There is a timing bug in all three hooks' (
useFeature
,useExperiment
, anduseDecision
) that leads toautoUpdate: true
render triggers getting lost.The code in #125 introduced a window of time between the mounting of the hook and the registering a listener for config or user changes. If the user (or presumably the config) is changed in that window of time, an update will not be triggered.
This pattern is used in all of the hooks.
If the user is changed too soon, the listener will still be set up, but it will be too late. The change has already occurred and the decision has not be reassessed.
I would propose that, immediately before setting up the listener, the code must determine if the user or config has changed since the hook was mounted. If so, it should execute the
setState
code prior to setting up the listener. For example: