Unleash/unleash-proxy-client-js

updateContext and setContextField don't call fetchToggles until first fetchToggles completes

mc0 opened this issue · 2 comments

mc0 commented

Describe the bug

After changing the context via updateContext, a new request for toggles doesn't trigger immediately. This looks like it's because the first fetchToggles and/or ready promise hasn't returned in start yet and timerRef isn't set.

Additionally, this means .start can be called multiple times until any chain of promises resolve.

Steps to reproduce the bug

  • Start a client.
  • Update the context after.
  • Observe no request for toggles with the latest context.

Expected behavior

When calling updateContext, a new request for fetchToggles should occur immediately if start has already been called.

Logs, error output, etc.

No response

Screenshots

No response

Additional context

Using @unleash/proxy-client-react and we are changing the context in a child component.

Unleash version

4.17.2

Subscription type

Pro

Hosting type

Hosted by Unleash

SDK information (language and version)

No response

Hi @mc0,

Thanks for the report. We're looking into it!

@mc0 #130 should fix it