fix: make setContextField and removeContextField be async#254
fix: make setContextField and removeContextField be async#254gastonfournier merged 1 commit intoUnleash:mainfrom
Conversation
| } | ||
|
|
||
| this.updateToggles(); | ||
| await this.updateToggles(); |
There was a problem hiding this comment.
Maybe we should just return this.updateToggles() here?
@kwasniew what do you think about this?
There was a problem hiding this comment.
In flutter we have Promise equivalent: https://github.com/Unleash/unleash-flutter-sdk/blob/main/lib/unleash_proxy_client_flutter.dart#L350
I think we should incorporate this change as it is now
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
@gastonfournier any update on this? |
kwasniew
left a comment
There was a problem hiding this comment.
I think it's a good change and is pretty much aligned with out flutter SDK that I was working on in the past: https://github.com/Unleash/unleash-flutter-sdk/blob/main/lib/unleash_proxy_client_flutter.dart#L350
Thanks! I'm still unsure if this is the way to go... having update toggles as a side effect of setting context fields. Making it event-driven is kind of the same: you can't await updateContext, you'd have to await for an event to arrive. There's an alternative approach in the Java SDK where we allow you to manually call updateToggles which you can await. But given @kwasniew is fine with this, I'm also fine with this solution as is. |
Sorry! Summer happens :D Thanks for your patience, I'm merging this now |
About the changes
setContextFieldandremoveContextFieldusesupdateTogglesinside likeupdateContextbut bothsetContextFieldandremoveContextFielddon't awaitupdateToggles. Lead to a case that will get toggle that use old context value.This fix is add async to both function like
updateContextdoes. Now we can await both function