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 enum default value update when option deleted #7604

Merged
merged 4 commits into from
Oct 11, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Oct 11, 2024

Fix as isDefined also returns false if value is null and we still want to allow users to set defaultValue back to null

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 pull request modifies the updateOne method in the FieldMetadataService class to allow setting null as a valid defaultValue when updating field metadata, particularly affecting enum fields.

  • Modified packages/twenty-server/src/engine/metadata-modules/field-metadata/field-metadata.service.ts to allow null values for defaultValue
  • Changed condition in updateOne method from isDefined(defaultValue) to defaultValue !== undefined
  • Improves flexibility for users to reset default values to null when updating field metadata
  • Addresses issue where isDefined was incorrectly handling null values, preventing valid updates
  • Ensures consistency with the intended behavior of allowing null as a valid default value option

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

Comment on lines +397 to +400
defaultValue:
updatableFieldInput.defaultValue !== undefined
? updatableFieldInput.defaultValue
: existingFieldMetadata.defaultValue,
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: This change allows null values to be set as defaultValue. Ensure this doesn't break existing functionality for non-nullable fields.

@Weiko Weiko merged commit 8cf3262 into main Oct 11, 2024
8 checks passed
@Weiko Weiko deleted the c--fix-enum-default-value-update-when-option-deleted branch October 11, 2024 15:11
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