-
-
Notifications
You must be signed in to change notification settings - Fork 743
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(1-3363): frontend flag type should not return truthy for variant #9293
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
export const useUiFlag = <K extends keyof flags>(flag: K): boolean => { | ||
const { uiConfig } = useUiConfig(); | ||
const value = uiConfig?.flags?.[flag]; | ||
if (typeof value === 'boolean') { | ||
return value; | ||
} else if (typeof value !== 'undefined') { | ||
console.error(`Flag ${flag} does not return a boolean.`); | ||
} | ||
|
||
return uiConfig?.flags?.[flag] || false; | ||
return false; |
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.
While I think this is fine in theory, I'm not confident about changing it now because we have places where we depend on the contents. Yeh, ts found the one in feedback component, but I don't really trust it to monitor everywhere. I don't see what we gain by changing this function right now. I'd rather look at other options too before changing this one.
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's about 60 places, I can check it manually
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 don't know. That's a lot of stuff to do manually. It feels like a high risk, low reward move at this point. Lemme have a think about this. Let's continue the discussion tomorrow?
About the changes
Prevent issues with disabled variants resolving as truthy in frontend.