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(ui): kafka trigger with null header blocks test render on WebUI #3072

Merged
merged 2 commits into from Aug 16, 2023

Conversation

danielbdias
Copy link
Contributor

@danielbdias danielbdias commented Aug 16, 2023

This PR fixes a UI bug caused by tests with Kafka trigger and no headers.

Loom: https://www.loom.com/share/f246f488f58d4aefa2fe34a67bb6b6e4?sid=8753e331-70b6-4462-92a5-b1116ed0c23a

Changes

  • Add guard clause on KafkaRequest model
  • Removed unused field that is blocking demo deploy

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

@@ -19,6 +19,10 @@ const KafkaRequest = ({
messageKey = '',
messageValue = '',
}: TRawKafkaRequest): KafkaRequest => {
if (!headers) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We try to avoid side effects like this, I think it is better to have something like

headers: !headers ? [] : ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It makes sense. I've updated this code to something similar, using the notation (headers || []) when building the model:

    headers: (headers || []).map(({key = '', value = ''}) => ({

@danielbdias danielbdias merged commit ab8f000 into main Aug 16, 2023
30 checks passed
@danielbdias danielbdias deleted the fix/kafka-ui-header-crash branch August 16, 2023 20:40
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.

None yet

2 participants