-
Notifications
You must be signed in to change notification settings - Fork 315
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(lld): fix analytics useEffect in default #6871
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ 5 Ignored Deployments
|
const dispatch = useDispatch(); | ||
|
||
useEffect(() => { | ||
if (isLocked) return; |
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 think it is safer to wrap this:
if (isLocked) return; | |
if (!isLocked) { |
In previous use cases with useEffect
, having a return like this does not necessarily exit the function.
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.
Thanks !
54a3c64
to
af30868
Compare
if (!isLocked) { | ||
if (!analyticsFF?.enabled || hasSeenAnalyticsOptInPrompt) return; |
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.
if (!isLocked) { | |
if (!analyticsFF?.enabled || hasSeenAnalyticsOptInPrompt) return; | |
if (!isLocked && (analyticsFF?.enabled || !hasSeenAnalyticsOptInPrompt)) { |
af30868
to
7857c4e
Compare
dispatch(setShareAnalytics(false)); | ||
dispatch(setSharePersonalizedRecommendations(false)); | ||
}); | ||
if (!isLocked && analyticsFF?.enabled && !hasSeenAnalyticsOptInPrompt) { |
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.
why are we changing the logic? previously it was an or case?
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.
It does the same as before because now we execute the logic instead of returning when the if is true
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.
Yes it was an or case but we want to trigger the dispatches only if those 3 conditions are met:
- App unlocked
- feature flag is enabled
- the prompt has not been seen by the user
The OR case was a return if the user didn't see the prompt or if the FF is disabled
So we have the same thing here as before
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.
yikes
β Checklist
npx changeset
was attached.π Description
Fix analytics useEffect previously introduced that was overriding app.json
β Context
π§ Checklist for the PR Reviewers