-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: export use-open-feature-client-status with suspense support #1082
base: main
Are you sure you want to change the base?
Conversation
8172213
to
f1ff607
Compare
* @returns {ProviderStatus} status of the client for this scope | ||
*/ | ||
export function useOpenFeatureClientStatus(): ProviderStatus { | ||
export function useOpenFeatureClientStatus(options?: Options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the great debate of return types 😅
const defaultedOptions = { ...DEFAULT_OPTIONS, ...useProviderOptions(), ...normalizeOptions(options) }; | ||
|
||
if (defaultedOptions.suspendUntilReady && status === ProviderStatus.NOT_READY) { | ||
suspendUntilReady(client); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the code here is identical to the useWhenProviderReady
hook - we might want to commonize it into a util.
* @returns {ProviderStatus} status of the client for this scope | ||
*/ | ||
export function useOpenFeatureClientStatus(): ProviderStatus { | ||
export function useOpenFeatureClientStatus(options?: Options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We call this hook internally from useWhenProviderReady
; we should probably explicitly disable suspense in the call from that hook so we don't suspend when we don't want to (since that hook also has it's own suspense logic).
@wichopy Sorry for the delay - KubeCon really slowed things down for us, still playing some catch-up! I still think this is valuable, and I think you're on the right track. I left some thoughts. We also need some tests (probably very similar to the other tests involving hooks and suspense). |
Signed-off-by: William Chou <[email protected]> Signed-off-by: Will Chou <[email protected]>
Signed-off-by: William Chou <[email protected]> Signed-off-by: Will Chou <[email protected]>
Signed-off-by: Will Chou <[email protected]>
Signed-off-by: Will Chou <[email protected]>
Signed-off-by: Will Chou <[email protected]>
Signed-off-by: Will Chou <[email protected]>
This PR
exposes the internal open feature client status hook so developers can act on non-ready resolved states
Related Issues
Fixes #1036
Notes
Follow-up Tasks
How to test