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

fix: add a flag to save the first loading status of the FFs #1051

Merged
merged 1 commit into from
Nov 29, 2022

Conversation

juanmahidalgo
Copy link
Contributor

Closes #1050

Right now, the useEffect depends on isLoadingFeatureFlags, which toggles between false and true on every single request (one per minute). We just need to know the first time if loads.

Comment on lines +21 to +26
const [hasLoadedInitialFlags, setHasLoadedInitialFlags] = useState(false)
useEffect(() => {
if (!isLoadingFeatureFlags) {
setHasLoadedInitialFlags(true)
}
}, [isLoadingFeatureFlags])
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that it's a bit more work, but, what if we move this logic to the features flag reducer so we can eventually use it somewhere else in the future? That is, when the FF are fetched successful for the first time, we can store a flag in the feature flags state and retrieve it later with a selector.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will be implemented when #290 is implemented

@juanmahidalgo juanmahidalgo merged commit a3c65e1 into master Nov 29, 2022
@juanmahidalgo juanmahidalgo deleted the fix/ff-loading-extra-requests branch November 29, 2022 15:08
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.

The AssetProvider is fetching the Asset data in every feature flags request
2 participants