-
Notifications
You must be signed in to change notification settings - Fork 36
feat: add polyfill for react use hook #1157
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
Conversation
Signed-off-by: Michael Beemer <[email protected]>
Signed-off-by: Michael Beemer <[email protected]>
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.
This generally looks good to me!
I left one concern that I am not really sure about.
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.
Don't see anything obviously violating here, but I haven't done the due diligence to run it locally yet
Signed-off-by: Michael Beemer <[email protected]>
Co-authored-by: Todd Baert <[email protected]> Signed-off-by: Michael Beemer <[email protected]>
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.
I tested this in the react demo app and it worked as expected.
🤖 I have created a release *beep* *boop* --- ## [1.0.0](react-sdk-v0.4.11...react-sdk-v1.0.0) (2025-04-14) ### ✨ New Features * add polyfill for react use hook ([#1157](#1157)) ([5afe61f](5afe61f)) * add support for abort controllers to event handlers ([#1151](#1151)) ([6a22483](6a22483)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Signed-off-by: OpenFeature Bot <[email protected]> Signed-off-by: Todd Baert <[email protected]> Co-authored-by: Todd Baert <[email protected]>
This PR
use
polyfillNotes
Previously, the Next.JS build process would timeout when using a suspense flag hook. The reason for this is because the noop provider (which is used during a build) is never ready. That meant that the promise thrown to initiate suspense never resolved. To address this, I've added global state using a weak map that's keyed off a provider. A
useRef
won't help because the value is only retained if the component renders successfully.Note
This unblocks suspense in our demo app but does not mean NextJS is officially support (yet).
How to test
I've added some tests and manually tested in the Toggle Shop.