-
Notifications
You must be signed in to change notification settings - Fork 715
fix: update table chart no data validation logic (#8422) #8431
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: update table chart no data validation logic (#8422) #8431
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR modifies the data validation logic for table panels in the PanelSchemaRenderer component. Previously, tables used the same validation logic as charts, which required both X and Y field aliases to have non-null values simultaneously using every() for strict validation. The change introduces table-specific logic that is more permissive:
- Tables now return true if there's more than one data row
- OR if there's exactly one row with at least one non-null value in either X or Y field aliases
- Uses
some()instead ofevery()for field validation - Separates X and Y field checks with OR logic instead of AND
This change addresses the core difference between chart and table data requirements. Charts typically need both X and Y values to render meaningful visualizations, but tables can display partial data usefully - they can show meaningful content even when some fields are null or when only X or Y fields have data. The modification prevents tables from incorrectly showing 'No Data' when they contain displayable information, making the validation logic more appropriate for tabular data presentation.
Confidence score: 4/5
- This PR is safe to merge with low risk as it addresses a specific UI issue without affecting core functionality
- Score reflects a targeted fix that improves user experience by making table data validation more appropriate for the use case
- Pay close attention to the PanelSchemaRenderer.vue file to ensure the new validation logic works correctly across different table scenarios
1 file reviewed, 2 comments
| case "table": { | ||
| // For tables, simply check if there's any data in the array | ||
| return ( | ||
| data.value[0]?.length > 1 || | ||
| (data.value[0]?.length == 1 && | ||
| xAlias.some((x: any) => data.value[0][0][x] != null)) || | ||
| yAlias.some((y: any) => data.value[0][0][y] != null) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The validation logic change from every() to some() and AND to OR makes tables more permissive. Consider if this could cause tables to display when they shouldn't have meaningful data to show.
| xAlias.some((x: any) => data.value[0][0][x] != null)) || | ||
| yAlias.some((y: any) => data.value[0][0][y] != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: The parentheses grouping suggests the OR condition for yAlias applies regardless of data array length. This might show data even when the first condition fails and xAlias check fails.
93ce9de to
04558c4
Compare
No description provided.