Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sync metadata default value not being synced #9163

Merged

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Dec 20, 2024

Context

We used to not sync defaultValue and recently introduced a change in https://github.com/twentyhq/twenty/blob/3340f01c312de9d9ca6a4f19f45437d9d850fff0/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/comparators/workspace-field.comparator.ts
with shouldNotOverrideDefaultValue to sync it for specific field metadata type that can't be overwritten by the user.
This means we should have removed 'defaultValue' from commonFieldPropertiesToIgnore list since it was handled differently.
This PR fixes that

Before
Screenshot 2024-12-20 at 11 04 09

After
Screenshot 2024-12-20 at 11 04 55

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.

PR Summary

This PR fixes the metadata syncing by removing 'defaultValue' from the ignored properties list, allowing it to be properly synced while maintaining type-specific override protections.

  • Removed 'defaultValue' from commonFieldPropertiesToIgnore in /packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/comparators/workspace-field.comparator.ts
  • defaultValue syncing is now controlled by shouldNotOverrideDefaultValue function for specific field types (BOOLEAN, SELECT, etc.)
  • Property is properly stringified during comparison via fieldPropertiesToStringify array

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@charlesBochet charlesBochet merged commit 779c503 into main Dec 20, 2024
22 checks passed
@charlesBochet charlesBochet deleted the c--fix-sync-metadata-default-value-not-being-synced branch December 20, 2024 10:42
mdrazak2001 pushed a commit to mdrazak2001/twenty that referenced this pull request Dec 20, 2024
## Context
We used to not sync defaultValue and recently introduced a change in
https://github.com/twentyhq/twenty/blob/3340f01c312de9d9ca6a4f19f45437d9d850fff0/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/comparators/workspace-field.comparator.ts
with shouldNotOverrideDefaultValue to sync it for specific field
metadata type that can't be overwritten by the user.
This means we should have removed 'defaultValue' from
commonFieldPropertiesToIgnore list since it was handled differently.
This PR fixes that

Before
<img width="792" alt="Screenshot 2024-12-20 at 11 04 09"
src="https://github.com/user-attachments/assets/1771c5a3-2162-4013-8a08-c54d2619fda3"
/>

After
<img width="798" alt="Screenshot 2024-12-20 at 11 04 55"
src="https://github.com/user-attachments/assets/33e09f16-c615-4a43-950d-d2df955fb196"
/>
samyakpiya pushed a commit to samyakpiya/twenty that referenced this pull request Dec 28, 2024
## Context
We used to not sync defaultValue and recently introduced a change in
https://github.com/twentyhq/twenty/blob/3340f01c312de9d9ca6a4f19f45437d9d850fff0/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/comparators/workspace-field.comparator.ts
with shouldNotOverrideDefaultValue to sync it for specific field
metadata type that can't be overwritten by the user.
This means we should have removed 'defaultValue' from
commonFieldPropertiesToIgnore list since it was handled differently.
This PR fixes that

Before
<img width="792" alt="Screenshot 2024-12-20 at 11 04 09"
src="https://github.com/user-attachments/assets/1771c5a3-2162-4013-8a08-c54d2619fda3"
/>

After
<img width="798" alt="Screenshot 2024-12-20 at 11 04 55"
src="https://github.com/user-attachments/assets/33e09f16-c615-4a43-950d-d2df955fb196"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants