Skip to content

Commit cc312e7

Browse files
authored
feat(laravel-insights): Disable for other platforms (#87263)
Make the toggle for the new overview only available for if laravel project(s) are selected
1 parent 293547d commit cc312e7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

static/app/views/insights/pages/backend/laravel/features.tsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,16 @@ export function hasLaravelInsightsFeature(organization: Organization) {
1414

1515
export function useIsLaravelInsightsAvailable() {
1616
const organization = useOrganization();
17+
const {projects} = useProjects();
18+
const {selection} = usePageFilters();
19+
20+
const selectedProjects = getSelectedProjectList(selection.projects, projects);
21+
22+
const isOnlyLaravelSelected = selectedProjects.every(
23+
project => project.platform === 'php-laravel'
24+
);
1725

18-
return hasLaravelInsightsFeature(organization);
26+
return hasLaravelInsightsFeature(organization) && isOnlyLaravelSelected;
1927
}
2028

2129
// It started out as a dictionary of project IDs, but as we now want a global toggle we use a special key
@@ -24,20 +32,12 @@ const ALL_PROJECTS_KEY = 'all';
2432

2533
export function useIsLaravelInsightsEnabled() {
2634
const organization = useOrganization();
27-
const {projects} = useProjects();
28-
const {selection} = usePageFilters();
2935
const user = useUser();
30-
31-
const selectedProjects = getSelectedProjectList(selection.projects, projects);
32-
33-
// The new experience is enabled by default for Laravel projects
34-
const defaultValue = Boolean(
35-
selectedProjects.every(project => project.platform === 'php-laravel')
36-
);
36+
const isAvailable = useIsLaravelInsightsAvailable();
3737

3838
const isEnabled = Boolean(
39-
hasLaravelInsightsFeature(organization) &&
40-
(user.options.prefersSpecializedProjectOverview[ALL_PROJECTS_KEY] ?? defaultValue)
39+
isAvailable &&
40+
(user.options.prefersSpecializedProjectOverview[ALL_PROJECTS_KEY] ?? true)
4141
);
4242

4343
const {mutate: mutateUserOptions} = useMutateUserOptions();

0 commit comments

Comments
 (0)