diff --git a/packages/insomnia/src/ui/components/panes/project-empty-state-pane.tsx b/packages/insomnia/src/ui/components/panes/project-empty-state-pane.tsx index 5e23ebd0c05..4ae7467c649 100644 --- a/packages/insomnia/src/ui/components/panes/project-empty-state-pane.tsx +++ b/packages/insomnia/src/ui/components/panes/project-empty-state-pane.tsx @@ -1,11 +1,11 @@ -import React, { FC, useEffect } from 'react'; -import { useFetcher, useParams } from 'react-router-dom'; +import React, { FC } from 'react'; +import { useParams } from 'react-router-dom'; import styled from 'styled-components'; import { getAccountId } from '../../../account/session'; import { getAppWebsiteBaseURL } from '../../../common/constants'; import { isOwnerOfOrganization } from '../../../models/organization'; -import { OrganizationFeatureLoaderData, useOrganizationLoaderData } from '../../../ui/routes/organization'; +import { useOrganizationLoaderData } from '../../../ui/routes/organization'; import { useRootLoaderData } from '../../routes/root'; import { showModal } from '../modals'; import { AlertModal } from '../modals/alert-modal'; @@ -77,28 +77,15 @@ interface Props { createMockServer: () => void; importFrom: () => void; cloneFromGit: () => void; + isGitSyncEnabled: boolean; } -export const EmptyStatePane: FC = ({ createRequestCollection, createDesignDocument, createMockServer, importFrom, cloneFromGit }) => { +export const EmptyStatePane: FC = ({ createRequestCollection, createDesignDocument, createMockServer, importFrom, cloneFromGit, isGitSyncEnabled }) => { const { organizationId } = useParams<{ organizationId: string }>(); const { organizations } = useOrganizationLoaderData(); const { userSession } = useRootLoaderData(); const currentOrg = organizations.find(organization => (organization.id === organizationId)); - const permissionsFetcher = useFetcher({ key: `permissions:${organizationId}` }); - useEffect(() => { - const isIdleAndUninitialized = permissionsFetcher.state === 'idle' && !permissionsFetcher.data; - if (isIdleAndUninitialized) { - permissionsFetcher.load(`/organization/${organizationId}/permissions`); - } - }, [organizationId, permissionsFetcher]); - - const { features } = permissionsFetcher.data || { - features: { - gitSync: { enabled: false, reason: 'Insomnia API unreachable' }, - }, - }; - const isGitSyncEnabled = features.gitSync.enabled; const accountId = getAccountId(); const showUpgradePlanModal = () => { diff --git a/packages/insomnia/src/ui/index.tsx b/packages/insomnia/src/ui/index.tsx index 7c2adfd22f1..91000fc5a44 100644 --- a/packages/insomnia/src/ui/index.tsx +++ b/packages/insomnia/src/ui/index.tsx @@ -212,6 +212,7 @@ async function renderApp() { ( await import('./routes/organization') ).organizationPermissionsLoader(...args), + shouldRevalidate: data => data.currentParams.organizationId !== data.nextParams.organizationId, }, { path: 'sync-projects', diff --git a/packages/insomnia/src/ui/routes/project.tsx b/packages/insomnia/src/ui/routes/project.tsx index e5552c72bc1..c2f623431dc 100644 --- a/packages/insomnia/src/ui/routes/project.tsx +++ b/packages/insomnia/src/ui/routes/project.tsx @@ -1252,6 +1252,7 @@ const ProjectRoute: FC = () => { createMockServer={createNewMockServer} importFrom={() => setImportModalType('file')} cloneFromGit={importFromGit} + isGitSyncEnabled={isGitSyncEnabled} /> ); }}