configcat / react-sdk

ConfigCat SDK for React. ConfigCat is a hosted feature flag service: https://configcat.com. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.
MIT License
12 stars 7 forks source link

Pass user object to ConfigCatProvider #13

Closed cruessler closed 1 year ago

cruessler commented 1 year ago

Is your feature request related to a problem? Please describe.

Currently, if I want to retrieve feature flags for a specific user, there is only one way to achieve that. I have to pass a user object to useFeatureFlag.

https://configcat.com/docs/sdk-reference/react/#user-object

Describe the solution you'd like

I would have expected to be able to pass a user object to ConfigCatProvider, and that every call to useFeatureFlag in one of its descendants then implicitly uses that user object when querying for feature flags.

Describe alternatives you've considered

I could use useFeatureFlag, but that would be more effort because I would have to get a user object and pass it to useFeatureFlag everywhere I use useFeatureFlag.

Additional context

I don’t know whether the omission of this feature was a deliberate decision, so maybe this has already been thought through and decided against.

laliconfigcat commented 1 year ago

Hello @cruessler ,

Thanks for reaching out. We are discussing it with the team, and we'll get back to you.

Cheers,

laliconfigcat commented 1 year ago

Hello @cruessler,

We are currently working on the default user feature in all of our SDKs (and some other cool new features): https://trello.com/c/0pvK6RvY/67-major-sdk-upgrades You will be able to pass a default user to the ConfigCatProvider as well in the next major SDK release.

Cheers,

cruessler commented 1 year ago

@laliconfigcat That’s great news! And thanks for the quick reply!

github-actions[bot] commented 1 year ago

This issue is marked stale because it has no activity in the last 3 weeks. The issue will be closed in one week. Please remove the stale flag to keep it open.

laliconfigcat commented 1 year ago

Hello there,

We've just released the new SDK with the requested feature. You can read more about it here: https://configcat.com/docs/sdk-reference/react/#default-user

Let me know if you have any questions. Any kind of feedback is much appreciated.

Cheers, Lali

cruessler commented 1 year ago

Thank you very much, we’ll try the new feature and let you know if we find any issues!