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(1-3363): frontend flag type should not return truthy for variant #9293

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Tymek
Copy link
Member

@Tymek Tymek commented Feb 11, 2025

About the changes

Prevent issues with disabled variants resolving as truthy in frontend.

Copy link

vercel bot commented Feb 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 1:40pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Feb 11, 2025 1:40pm

Copy link
Contributor

github-actions bot commented Feb 11, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

Comment on lines +5 to +14
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;
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants