Compare commits

...

1 Commits

Author SHA1 Message Date
claude[bot] 265ee2a921 fix(server): preserve shouldHideEmptyGroups and anyFieldFilterValue in view manifest sync
The fromViewManifestToUniversalFlatView converter hardcoded two additional
view fields instead of reading them from the manifest:
- shouldHideEmptyGroups (hardcoded to false)
- anyFieldFilterValue (hardcoded to null)

Follow-up to #19946, which fixed the same class of bug for five kanban/calendar
fields. These two fields are accepted by CreateViewInput and persisted on
ViewEntity, so an app manifest should be able to set them — today the
converter silently drops any value the SDK author provides.

- Add both fields to ViewManifest in twenty-shared
- Read from manifest with ?? default in the converter
- Extend the converter spec with preservation + default cases

Co-authored-by: Félix Malfait <FelixMalfait@users.noreply.github.com>
2026-04-22 14:37:43 +00:00
3 changed files with 37 additions and 2 deletions
@@ -132,4 +132,37 @@ describe('fromViewManifestToUniversalFlatView', () => {
'field-uuid-date',
);
});
it('should preserve shouldHideEmptyGroups and anyFieldFilterValue from the manifest', () => {
const result = fromViewManifestToUniversalFlatView({
viewManifest: {
universalIdentifier: 'view-uuid-6',
name: 'Kanban Board',
objectUniversalIdentifier: 'object-uuid-1',
type: ViewType.KANBAN,
shouldHideEmptyGroups: true,
anyFieldFilterValue: 'search-query',
},
applicationUniversalIdentifier,
now,
});
expect(result.shouldHideEmptyGroups).toBe(true);
expect(result.anyFieldFilterValue).toBe('search-query');
});
it('should default shouldHideEmptyGroups to false and anyFieldFilterValue to null when omitted', () => {
const result = fromViewManifestToUniversalFlatView({
viewManifest: {
universalIdentifier: 'view-uuid-7',
name: 'All Records',
objectUniversalIdentifier: 'object-uuid-1',
},
applicationUniversalIdentifier,
now,
});
expect(result.shouldHideEmptyGroups).toBe(false);
expect(result.anyFieldFilterValue).toBeNull();
});
});
@@ -38,8 +38,8 @@ export const fromViewManifestToUniversalFlatView = ({
viewManifest.calendarFieldMetadataUniversalIdentifier ?? null,
mainGroupByFieldMetadataUniversalIdentifier:
viewManifest.mainGroupByFieldMetadataUniversalIdentifier ?? null,
shouldHideEmptyGroups: false,
anyFieldFilterValue: null,
shouldHideEmptyGroups: viewManifest.shouldHideEmptyGroups ?? false,
anyFieldFilterValue: viewManifest.anyFieldFilterValue ?? null,
createdByUserWorkspaceId: null,
viewFieldUniversalIdentifiers: [],
viewFilterUniversalIdentifiers: [],
@@ -74,6 +74,8 @@ export type ViewManifest = SyncableEntityOptions & {
kanbanAggregateOperationFieldMetadataUniversalIdentifier?: string;
calendarLayout?: ViewCalendarLayout;
calendarFieldMetadataUniversalIdentifier?: string;
shouldHideEmptyGroups?: boolean;
anyFieldFilterValue?: string | null;
fields?: ViewFieldManifest[];
filters?: ViewFilterManifest[];
filterGroups?: ViewFilterGroupManifest[];