Skip to content

The open alternative to Salesforce, designed for AI.

fast-follows: fix placeholder not appearing when no widgets in a tab (#15599)

nitin186dbb8aca61
diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridLayout.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridLayout.tsx
index fc92c163ae3..8c344bd11b5 100644
--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridLayout.tsx
+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridLayout.tsx
@@ -113,8 +113,7 @@ export const PageLayoutGridLayout = ({ tabId }: PageLayoutGridLayoutProps) => {
const isLayoutEmpty =
!isDefined(activeTabWidgets) || activeTabWidgets.length === 0;
- const hasPendingPlaceholder =
- isDefined(pageLayoutDraggedArea) && !isLayoutEmpty;
+ const hasPendingPlaceholder = isDefined(pageLayoutDraggedArea);
const baseLayouts = isLayoutEmpty
? EMPTY_LAYOUT
diff --git a/packages/twenty-front/src/modules/page-layout/utils/__tests__/prepareGridLayoutItemsWithPlaceholders.test.ts b/packages/twenty-front/src/modules/page-layout/utils/__tests__/prepareGridLayoutItemsWithPlaceholders.test.ts
index 2132739c5dc..642aa905b1b 100644
--- a/packages/twenty-front/src/modules/page-layout/utils/__tests__/prepareGridLayoutItemsWithPlaceholders.test.ts
+++ b/packages/twenty-front/src/modules/page-layout/utils/__tests__/prepareGridLayoutItemsWithPlaceholders.test.ts
@@ -53,12 +53,12 @@ describe('prepareGridLayoutItemsWithPlaceholders', () => {
});
});
- it('should return empty placeholder even when shouldIncludePendingPlaceholder is true', () => {
+ it('should return pending placeholder when shouldIncludePendingPlaceholder is true and layout is empty', () => {
const result = prepareGridLayoutItemsWithPlaceholders([], true);
expect(result).toHaveLength(1);
expect(result[0]).toEqual({
- id: 'empty-placeholder',
+ id: PENDING_WIDGET_PLACEHOLDER_LAYOUT_KEY,
type: 'placeholder',
});
});
diff --git a/packages/twenty-front/src/modules/page-layout/utils/prepareGridLayoutItemsWithPlaceholders.ts b/packages/twenty-front/src/modules/page-layout/utils/prepareGridLayoutItemsWithPlaceholders.ts
index 6c97fd8fb38..641fcc41825 100644
--- a/packages/twenty-front/src/modules/page-layout/utils/prepareGridLayoutItemsWithPlaceholders.ts
+++ b/packages/twenty-front/src/modules/page-layout/utils/prepareGridLayoutItemsWithPlaceholders.ts
@@ -10,6 +10,15 @@ export const prepareGridLayoutItemsWithPlaceholders = (
const hasWidgets = isDefined(widgets) && widgets.length > 0;
if (!hasWidgets) {
+ if (shouldIncludePendingPlaceholder) {
+ return [
+ {
+ id: PENDING_WIDGET_PLACEHOLDER_LAYOUT_KEY,
+ type: 'placeholder' as const,
+ },
+ ];
+ }
+
return [
{
id: 'empty-placeholder',