Skip to content

The open alternative to Salesforce, designed for AI.

Let app page layout manifests set isFirstTabPinned (#27629)

martmulla9df5c3aad6c
diff --git a/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/__tests__/from-flat-page-layout-to-page-layout-manifest.util.spec.ts b/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/__tests__/from-flat-page-layout-to-page-layout-manifest.util.spec.ts
index 343b5263b91..149c3dfdfb0 100644
--- a/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/__tests__/from-flat-page-layout-to-page-layout-manifest.util.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/__tests__/from-flat-page-layout-to-page-layout-manifest.util.spec.ts
@@ -27,6 +27,7 @@ const PAGE_LAYOUT_MANIFEST: Required<Omit<PageLayoutManifest, 'tabs'>> = {
type: PageLayoutType.RECORD_PAGE,
objectUniversalIdentifier: OBJECT_UID,
defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier: TAB_UID,
+ isFirstTabPinned: false,
};
const MINIMAL_PAGE_LAYOUT_MANIFEST: PageLayoutManifest = {
diff --git a/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/__tests__/from-page-layout-manifest-to-universal-flat-page-layout.util.spec.ts b/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/__tests__/from-page-layout-manifest-to-universal-flat-page-layout.util.spec.ts
index 4bee0c85cad..0efad070ba9 100644
--- a/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/__tests__/from-page-layout-manifest-to-universal-flat-page-layout.util.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/__tests__/from-page-layout-manifest-to-universal-flat-page-layout.util.spec.ts
@@ -27,6 +27,7 @@ describe('fromPageLayoutManifestToUniversalFlatPageLayout', () => {
result.defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier,
).toBeNull();
expect(result.tabUniversalIdentifiers).toEqual([]);
+ expect(result.isFirstTabPinned).toBe(true);
});
it('should convert a record page layout manifest', () => {
@@ -66,4 +67,20 @@ describe('fromPageLayoutManifestToUniversalFlatPageLayout', () => {
result.defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier,
).toBe('tab-uuid-1');
});
+
+ it('should keep the first tab unpinned when the manifest says so', () => {
+ const result = fromPageLayoutManifestToUniversalFlatPageLayout({
+ pageLayoutManifest: {
+ universalIdentifier: 'pl-uuid-4',
+ name: 'Unpinned Record Layout',
+ type: PageLayoutType.RECORD_PAGE,
+ objectUniversalIdentifier: 'obj-uuid-1',
+ isFirstTabPinned: false,
+ },
+ applicationUniversalIdentifier,
+ now,
+ });
+
+ expect(result.isFirstTabPinned).toBe(false);
+ });
});
diff --git a/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/from-flat-page-layout-to-page-layout-manifest.util.ts b/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/from-flat-page-layout-to-page-layout-manifest.util.ts
index 230a2d72243..15bfcc4a7b5 100644
--- a/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/from-flat-page-layout-to-page-layout-manifest.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/from-flat-page-layout-to-page-layout-manifest.util.ts
@@ -30,5 +30,8 @@ export const fromFlatPageLayoutToPageLayoutManifest = ({
flatPageLayout.defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier,
}
: {}),
+ ...(flatPageLayout.isFirstTabPinned === false
+ ? { isFirstTabPinned: false }
+ : {}),
...(isNonEmptyArray(tabs) ? { tabs } : {}),
});
diff --git a/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/from-page-layout-manifest-to-universal-flat-page-layout.util.ts b/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/from-page-layout-manifest-to-universal-flat-page-layout.util.ts
index 2bf2de58780..249fbf87da6 100644
--- a/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/from-page-layout-manifest-to-universal-flat-page-layout.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/application/application-manifest/converters/from-page-layout-manifest-to-universal-flat-page-layout.util.ts
@@ -24,7 +24,7 @@ export const fromPageLayoutManifestToUniversalFlatPageLayout = ({
navigationMenuItemUniversalIdentifiers: [],
tabUniversalIdentifiers: [],
isSystemSideEffect: false,
- isFirstTabPinned: true,
+ isFirstTabPinned: pageLayoutManifest.isFirstTabPinned ?? true,
createdAt: now,
updatedAt: now,
deletedAt: null,
diff --git a/packages/twenty-server/src/engine/core-modules/application/application-manifest/utils/__tests__/export-covers-compared-properties.spec.ts b/packages/twenty-server/src/engine/core-modules/application/application-manifest/utils/__tests__/export-covers-compared-properties.spec.ts
index e7026f7b48f..581b47de0b0 100644
--- a/packages/twenty-server/src/engine/core-modules/application/application-manifest/utils/__tests__/export-covers-compared-properties.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/application/application-manifest/utils/__tests__/export-covers-compared-properties.spec.ts
@@ -207,6 +207,7 @@ const PAGE_LAYOUT_MANIFEST: PageLayoutManifest = {
type: PageLayoutType.RECORD_PAGE,
objectUniversalIdentifier: OBJECT_UID,
defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier: PAGE_LAYOUT_TAB_UID,
+ isFirstTabPinned: false,
tabs: [PAGE_LAYOUT_TAB_MANIFEST],
};
@@ -552,11 +553,7 @@ const EXPORTED_KINDS: ExportedKind[] = [
objectMetadataUniversalIdentifier: 'objectUniversalIdentifier',
},
workspaceLocalProperties: [],
- knownGaps: {
- ...PAGE_LAYOUT_KIND_GAPS,
- isFirstTabPinned:
- 'workspace-owned: the sync keeps the live value, so the forward default never diffs',
- },
+ knownGaps: PAGE_LAYOUT_KIND_GAPS,
},
{
metadataName: 'pageLayoutTab',
diff --git a/packages/twenty-shared/src/application/pageLayoutManifestType.ts b/packages/twenty-shared/src/application/pageLayoutManifestType.ts
index 16818fe16a1..d0aabffb488 100644
--- a/packages/twenty-shared/src/application/pageLayoutManifestType.ts
+++ b/packages/twenty-shared/src/application/pageLayoutManifestType.ts
@@ -38,5 +38,6 @@ export type PageLayoutManifest = SyncableEntityOptions & {
type: PageLayoutType;
objectUniversalIdentifier?: string;
defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier?: string;
+ isFirstTabPinned?: boolean;
tabs?: PageLayoutTabManifest[];
};