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(CanvasForm): Avoid adding {} to the Source code #879

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

lordrip
Copy link
Member

@lordrip lordrip commented Feb 28, 2024

Currently, the uniforms library, initializes object fields with empty objects when there's a required property inside them.

This is prevented by checking the value of the incoming change in the CanvasForm component, and while this works, it collides with the Kamelet's custom form, since the user might want to remove all annotations, leaving the form with an intended empty object.

The fix for this issue is to remove said check and place it in the setValue function instead.

The mechanism now is to check whether the value to assign is an empty object, in which case it's replaced with an undefined value instead.

This prevents for this value to be serialized into the Source code.

fix: #878

Currently, the uniforms library, initializes object fields with empty
objects when there's a required property inside them.

This is prevented by checking the value of the incoming change in the
CanvasForm component, and while this works, it collides with the
Kamelet's custom form, since the user might want to remove all
annotations, leaving the form with an intended empty object.

The fix for this issue is to remove said check and place it in the
`setValue` function instead.

The mechanism now is to check whether the value to assign is an empty
object, in which case it's replaced with an `undefined` value instead.

This prevents for this value to be serialized into the Source code.

fix: KaotoIO#878
@lhein lhein requested a review from tplevko February 28, 2024 10:38
@lordrip
Copy link
Member Author

lordrip commented Feb 28, 2024

Thanks for the review @tplevko 💪

@lordrip lordrip merged commit 804d88f into KaotoIO:main Feb 28, 2024
8 of 9 checks passed
@lordrip lordrip deleted the fix/avoid-adding-empty-objects branch February 28, 2024 12:05
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.

Avoid serializing empty objects ({}) to the Source code
2 participants