Skip to content

followup: centralize widget common properties and add widget bulk update integration tests#18225

Open
ehconitin wants to merge 5 commits intomainfrom
18015-followup
Open

followup: centralize widget common properties and add widget bulk update integration tests#18225
ehconitin wants to merge 5 commits intomainfrom
18015-followup

Conversation

@ehconitin
Copy link
Contributor

@ehconitin ehconitin commented Feb 25, 2026

followup #18015 (review)

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 25, 2026

Greptile Summary

This PR successfully refactors widget common property handling by introducing a centralized utility function and adds comprehensive integration tests for bulk widget updates.

Key changes:

  • Created buildFlatPageLayoutWidgetCommonProperties utility to eliminate duplicate code across widget creation, update, and restore operations
  • Refactored page-layout-update.service.ts to use the new utility in three places (widgetsToCreate, widgetsToUpdate, widgetsToRestoreAndUpdate), removing ~60 lines of duplicated logic
  • Added integration tests covering widget create, delete, restore, and mixed operation scenarios with snapshot validation
  • The refactoring maintains identical behavior while improving code maintainability and DRY principles

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The refactoring is straightforward and well-tested. The new utility function extracts identical logic that was duplicated across three locations, improving maintainability without changing behavior. Comprehensive integration tests with snapshots validate the bulk update operations including edge cases like mixed create/update/restore scenarios.
  • No files require special attention

Important Files Changed

Filename Overview
packages/twenty-server/src/engine/metadata-modules/flat-page-layout-widget/utils/build-flat-page-layout-widget-common-properties.util.ts New utility function to centralize common widget property building logic, eliminating code duplication
packages/twenty-server/src/engine/metadata-modules/page-layout/services/page-layout-update.service.ts Refactored widget create/update/restore operations to use centralized utility, eliminating ~60 lines of duplicated code
packages/twenty-server/test/integration/metadata/suites/page-layout/successful-page-layout-widget-restore-via-update.integration-spec.ts Comprehensive integration tests added for widget bulk update operations including create, delete, restore, and mixed scenarios

Last reviewed commit: 60f36ae

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

@ehconitin ehconitin requested a review from prastoin February 25, 2026 18:20
Copy link
Contributor

@prastoin prastoin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job !

@ehconitin
Copy link
Contributor Author

@charlesBochet could you merge this one for me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants