-
Notifications
You must be signed in to change notification settings - Fork 12.7k
fix: prevent premium capability popup when enterprise license is already in place #37950
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
base: develop
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: b3898fa The changes in this PR will be included in the next version bump. This PR includes changesets to release 40 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis pull request fixes a bug where the premium capability popup displayed incorrectly when an enterprise license was active. The fix refactors the enterprise status detection from direct license property access to a React Query-based method call and adds proper loading state handling to prevent premature upsell display. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (3)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (2)📚 Learning: 2025-10-06T20:32:23.658ZApplied to files:
📚 Learning: 2025-12-02T22:23:49.593ZApplied to files:
🧬 Code graph analysis (2)apps/meteor/client/components/GenericUpsellModal/hooks/useUpsellActions.ts (1)
apps/meteor/client/hooks/useIsEnterprise.ts (1)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
edc1e59 to
05b90a1
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #37950 +/- ##
===========================================
- Coverage 70.66% 70.64% -0.02%
===========================================
Files 3143 3143
Lines 108694 108704 +10
Branches 19572 19581 +9
===========================================
- Hits 76810 76799 -11
- Misses 29887 29902 +15
- Partials 1997 2003 +6
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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.
No issues found across 3 files
| const { data } = useIsEnterprise(); | ||
| const shouldShowUpsell = !data?.isEnterprise || !hasLicenseModule; | ||
| const { data, isPending } = useIsEnterprise(); | ||
| const shouldShowUpsell = !isPending && (!data?.isEnterprise || !hasLicenseModule); |
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 would suggest using isSuccess instead, because it can be true with some error as well
|
|
||
| export const useIsEnterprise = (): UseQueryResult<{ isEnterprise: boolean }> => { | ||
| return useLicenseBase({ select: (data) => ({ isEnterprise: Boolean(data?.license.license) }) }); | ||
| const isEnterpriseMethod = useMethod('license:isEnterprise'); |
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.
since we're moving away from meteor I don't think this is a good move. Can't we create an api route to check if its enterprise or something like that since license.info doesn't allow non-permission access
As per SUP-871, this PR fixes the issue where users with enterprise permissions (like
view-engagement-dashboard,view-device-management, etc.) but withoutview-privileged-settingpermission see "premium capability" popups despite the workspace having a valid Enterprise license.Proposed changes (including videos or screenshots)
useIsEnterprise()hook to use the existinglicense:isEnterpriseMeteor method instead of relying on/v1/licenses.infowhich returns license: undefined for non-privileged usersisPendingcheck inuseUpsellActionsto prevent race condition where popup shows before license data loadsIssue(s)
Steps to test or reproduce
engagement-dashboard,device-management, orcustom-rolesview-engagement-dashboardorview-device-managementview-privileged-settingpermission/admin/engagement/usersor/admin/permissionsBefore: premium capability popup appears
After: no popup appears, user can access the enterprise features
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.