Skip to content
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: re-render if flagsChanged is falsy #1095

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

toddbaert
Copy link
Member

@toddbaert toddbaert commented Dec 4, 2024

Adds an improvement to the React SDK which supports re-renders if the flags changed array from a provider event is falsy.

Since some providers have no knowledge of flags which are changed, this allows them to support dynamic re-rendering by not defining this property. If the prop is null/undefined, we diff all flags... If the property is explicitly set to an empty array, that means no flags have changed and the React SDK skips all diff checks.

@toddbaert toddbaert requested a review from a team as a code owner December 4, 2024 18:09
Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think this is a good change.

@toddbaert toddbaert added this pull request to the merge queue Dec 4, 2024
Merged via the queue into main with commit 78516f4 Dec 4, 2024
9 checks passed
@toddbaert toddbaert deleted the feat/re-render-flags-changed-falsy branch December 4, 2024 18:33
toddbaert pushed a commit that referenced this pull request Dec 4, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.4.9](react-sdk-v0.4.8...react-sdk-v0.4.9)
(2024-12-04)


### ✨ New Features

* re-render if flagsChanged is falsy
([#1095](#1095))
([78516f4](78516f4))


### 📚 Documentation

* fix typos, links, and format
([#1075](#1075))
([418409e](418409e))

---
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]>
wichopy pushed a commit to wichopy/openfeature-js-sdk that referenced this pull request Dec 31, 2024
Adds an improvement to the React SDK which supports re-renders if the
[flags
changed](https://open-feature.github.io/js-sdk/types/_openfeature_server_sdk.ConfigChangeEvent.html)
array from a provider event is falsy.

Since some providers have no knowledge of flags which are changed, this
allows them to support dynamic re-rendering by not defining this
property. If the prop is null/undefined, we diff all flags... If the
property is explicitly set to an empty array, that means no flags have
changed and the React SDK skips all diff checks.

Signed-off-by: Todd Baert <[email protected]>
Signed-off-by: Will Chou <[email protected]>
wichopy pushed a commit to wichopy/openfeature-js-sdk that referenced this pull request Dec 31, 2024
🤖 I have created a release *beep* *boop*
---

##
[0.4.9](open-feature/js-sdk@react-sdk-v0.4.8...react-sdk-v0.4.9)
(2024-12-04)

### ✨ New Features

* re-render if flagsChanged is falsy
([open-feature#1095](open-feature#1095))
([78516f4](open-feature@78516f4))

### 📚 Documentation

* fix typos, links, and format
([open-feature#1075](open-feature#1075))
([418409e](open-feature@418409e))

---
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: Will Chou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants