1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

feat: switch to hook without features list (#7085)

This commit is contained in:
Mateusz Kwasniewski 2024-05-20 13:52:21 +02:00 committed by GitHub
parent 3768331e9a
commit 0537d3d5f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 8 deletions

View File

@ -13,7 +13,7 @@ const setupApi = () => {
current: { enterprise: 'present' },
},
});
testServerRoute(server, '/api/admin/projects/default', {
testServerRoute(server, '/api/admin/projects/default/overview', {
environments: [
{ environment: 'development' },
{ environment: 'production' },

View File

@ -3,7 +3,7 @@ import KeyboardArrowDownOutlined from '@mui/icons-material/KeyboardArrowDownOutl
import { type FC, useEffect } from 'react';
import { Box, styled, Typography } from '@mui/material';
import { IMPORT_ENVIRONMENT } from 'utils/testIds';
import useProject from 'hooks/api/getters/useProject/useProject';
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
const ImportOptionsContainer = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.background.elevation2,
@ -31,7 +31,7 @@ export const ImportOptions: FC<IImportOptionsProps> = ({
environment,
onChange,
}) => {
const { project: projectInfo } = useProject(project);
const { project: projectInfo } = useProjectOverview(project);
const environmentOptions = projectInfo.environments.map(
({ environment }) => ({
key: environment,

View File

@ -1,5 +1,4 @@
import { useNavigate } from 'react-router';
import useProject from 'hooks/api/getters/useProject/useProject';
import useLoading from 'hooks/useLoading';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import {
@ -43,6 +42,7 @@ import { HiddenProjectIconWithTooltip } from './HiddenProjectIconWithTooltip/Hid
import { ChangeRequestPlausibleProvider } from 'component/changeRequest/ChangeRequestContext';
import { ProjectApplications } from '../ProjectApplications/ProjectApplications';
import { ProjectInsights } from './ProjectInsights/ProjectInsights';
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
const StyledBadge = styled(Badge)(({ theme }) => ({
position: 'absolute',
@ -65,7 +65,7 @@ interface ITab {
export const Project = () => {
const projectId = useRequiredPathParam('projectId');
const params = useQueryParams();
const { project, loading, error, refetch } = useProject(projectId);
const { project, loading, error, refetch } = useProjectOverview(projectId);
const ref = useLoading(loading, '[data-loading-project=true]');
const { setToastData, setToastApiError } = useToast();
const [modalOpen, setModalOpen] = useState(false);

View File

@ -2,7 +2,6 @@ import { useMemo, useState, type VFC } from 'react';
import { Button } from '@mui/material';
import { PermissionHOC } from 'component/common/PermissionHOC/PermissionHOC';
import { DELETE_FEATURE } from 'component/providers/AccessProvider/permissions';
import useProject from 'hooks/api/getters/useProject/useProject';
import { FeatureArchiveDialog } from 'component/common/FeatureArchiveDialog/FeatureArchiveDialog';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import type { FeatureSchema } from 'openapi';
@ -30,7 +29,6 @@ export const ArchiveButton: VFC<IArchiveButtonProps> = ({
features,
onConfirm,
}) => {
const { refetch } = useProject(projectId);
const [isDialogOpen, setIsDialogOpen] = useState(false);
const { trackEvent } = usePlausibleTracker();
@ -44,7 +42,6 @@ export const ArchiveButton: VFC<IArchiveButtonProps> = ({
const onArchive = async () => {
setIsDialogOpen(false);
onConfirm?.();
await refetch();
trackEvent('batch_operations', {
props: {
eventType: 'features archived',