Skip to content

The open alternative to Salesforce, designed for AI.

Show the section skeleton while the Apps tab loads installed apps (#29064)

nitin129e1511c449
diff --git a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesAppsSection.tsx b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesAppsSection.tsx
index 2e47b1fbb13..e492bfaee10 100644
--- a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesAppsSection.tsx
+++ b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesAppsSection.tsx
@@ -19,8 +19,15 @@ export const SettingsAppPreferencesAppsSection = () => {
const { t } = useLingui();
const navigateSettings = useNavigateSettings();
const { enabledBuiltInAccountApps } = useEnabledBuiltInAccountApps();
- const { applicationsWithPreferences, hasApplicationsLoadError, refetch } =
- useApplicationsWithPreferences();
+ const {
+ applicationsWithPreferences,
+ loading,
+ hasLoadedApplicationsWithPreferences,
+ hasApplicationsLoadError,
+ refetch,
+ } = useApplicationsWithPreferences();
+ const isLoadingApplications =
+ loading && !hasLoadedApplicationsWithPreferences;
const rows: AppPreferencesRow[] = [
...enabledBuiltInAccountApps.map(
@@ -54,6 +61,7 @@ export const SettingsAppPreferencesAppsSection = () => {
) : undefined
}
items={rows}
+ isLoading={isLoadingApplications}
columns={[
{ label: t`App`, Cell: SettingsAppPreferencesAppNameCell },
{
diff --git a/packages/twenty-front/src/modules/settings/app-preferences/hooks/useApplicationsWithPreferences.ts b/packages/twenty-front/src/modules/settings/app-preferences/hooks/useApplicationsWithPreferences.ts
index 0283d774a08..e12578796a5 100644
--- a/packages/twenty-front/src/modules/settings/app-preferences/hooks/useApplicationsWithPreferences.ts
+++ b/packages/twenty-front/src/modules/settings/app-preferences/hooks/useApplicationsWithPreferences.ts
@@ -22,6 +22,7 @@ export const useApplicationsWithPreferences = () => {
currentWorkspace,
}),
loading,
+ hasLoadedApplicationsWithPreferences,
hasApplicationsLoadError:
isDefined(error) && !hasLoadedApplicationsWithPreferences,
error,
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsTableListSection.tsx b/packages/twenty-front/src/modules/settings/components/SettingsTableListSection.tsx
index 9db826ba53d..3a352bc624e 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsTableListSection.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsTableListSection.tsx
@@ -4,6 +4,7 @@ import { isDefined } from 'twenty-shared/utils';
import { styled } from '@linaria/react';
+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';
import { Table } from '@/ui/layout/table/components/Table';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
@@ -59,6 +60,7 @@ type SettingsTableListSectionProps<Item extends { id: string }> = {
items: Item[];
columns: SettingsTableListSectionColumn<Item>[];
gridAutoColumns: string;
+ isLoading?: boolean;
showRowChevron?: boolean;
onRowClick?: (item: Item) => void;
footerButtonLabel?: string;
@@ -76,6 +78,7 @@ export const SettingsTableListSection = <
items,
columns,
gridAutoColumns,
+ isLoading = false,
showRowChevron = false,
onRowClick,
footerButtonLabel,
@@ -94,7 +97,8 @@ export const SettingsTableListSection = <
actions={headerAdornment}
/>
{isDefined(toolbar) && toolbar}
- {items.length > 0 && (
+ {isLoading && <SettingsSectionSkeletonLoader />}
+ {!isLoading && items.length > 0 && (
<Table>
<TableRow gridAutoColumns={resolvedGridAutoColumns}>
{columns.map((column) => (
diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx
index 3fa7d36fb51..73838551b21 100644
--- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx
+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx
@@ -197,6 +197,35 @@ export const WorkspaceSharedAppConnectionsStayOff: Story = {
},
};
+export const AppsSectionHeaderStaysWhileLoading: Story = {
+ ...accountGroupsStory,
+ beforeEach: seedApplicationPreferencesStory,
+ parameters: {
+ msw: {
+ handlers: [
+ graphql.query('MyApplicationPreferences', async () => {
+ await delay('infinite');
+ }),
+ ...APPLICATION_PREFERENCES_GRAPHQL_HANDLERS,
+ ],
+ },
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ expect(
+ await canvas.findByText(
+ 'Choose your preferences for the apps installed on your workspace by the admin',
+ undefined,
+ { timeout: 3000 },
+ ),
+ ).toBeVisible();
+ expect(canvas.getByRole('heading', { name: 'Apps' })).toBeVisible();
+ expect(canvasElement.querySelector('[aria-busy="true"]')).not.toBeNull();
+ expect(canvas.queryByText('Outlook')).not.toBeInTheDocument();
+ },
+};
+
export const AccountsSectionHeaderStaysWhileLoading: Story = {
...accountsTabStory,
parameters: {