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

Clean available fields in variable dropdown #8371

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

thomtrp
Copy link
Contributor

@thomtrp thomtrp commented Nov 6, 2024

As title

We do not want relations yet in picker

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 introduces field filtering logic for the workflow variable dropdown, excluding relation fields and improving fake value generation for workflow testing.

  • Fixed inverted logic in workflow-builder/utils/generate-fake-object-record.ts where shouldGenerateFieldFakeValue condition was incorrectly excluding valid fields
  • Added new utility shouldGenerateFieldFakeValue in workflow-builder/utils/should-generate-field-fake-value.ts to filter out system, inactive, and relation fields
  • Improved type clarity in workflow/types/Workflow.ts by renaming index signature parameter from 'hello' to 'key'

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

Comment on lines 9 to 11
if (shouldGenerateFieldFakeValue(field)) {
return acc;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Logic is inverted - shouldGenerateFieldFakeValue returns true for fields that SHOULD generate values, but here we're skipping those fields. Remove the ! operator or rename the function to be clearer.

Comment on lines +6 to +11
export const shouldGenerateFieldFakeValue = (field: FieldMetadataEntity) => {
return (
!field.isSystem &&
field.isActive &&
field.type !== FieldMetadataType.RELATION
);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider adding null/undefined check for field parameter to prevent runtime errors

@thomtrp thomtrp force-pushed the tt-clean-avalable-fields-in-variable-dropdown branch from 0392da2 to 2898993 Compare November 6, 2024 15:29
@thomtrp thomtrp merged commit 117e502 into main Nov 6, 2024
19 checks passed
@thomtrp thomtrp deleted the tt-clean-avalable-fields-in-variable-dropdown branch November 6, 2024 15:54
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