Unleash/unleash-proxy-client-js

feat: generate a random sessionId when not provided.

ivarconr opened this issue · 1 comments

Today the SDK does not set a default sessionId. The problem of not doing this is that we get a poor experience for "anonymous" users because evaluation happens on the server side. This could lead to a flickering behavior of feature flag state.

Today the user of this SDK can already generate their own sessionId and inject that as part of the unleashContext, but we see a lot of users that do not do this.

The purposed change is that this SDK should generate a random sessionId, if not provided by the user. This will allow the SDK to provide a more consistent behavior in a combination with a gradual rollout and anonymous users.

We should probably also store the ID inside the local storage to make sure it stays consistent with reloads (new page load) as well.