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: prevent table component from breaking with invalid data #1338

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

vsgoulart
Copy link
Contributor

This filters out invalid data from the table component which would make it break the entire editor if it happened.

Closes #1337

  • This PR adds a new form-js element or visually changes an existing component.

@vsgoulart vsgoulart requested a review from Skaiir December 18, 2024 18:09
@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Dec 18, 2024
@vsgoulart vsgoulart force-pushed the 1337-validate-table-data branch from 4071441 to 67dcafc Compare December 18, 2024 18:19
@@ -45,7 +45,9 @@ export function Table(props) {
const evaluatedColumns = useEvaluatedColumns(columnsExpression || '', columns);
const columnKeys = evaluatedColumns.map(({ key }) => key);
const evaluatedDataSource = useExpressionEvaluation(dataSource);
const data = Array.isArray(evaluatedDataSource) ? evaluatedDataSource.filter((i) => i !== undefined) : [];
const data = Array.isArray(evaluatedDataSource)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't really find a way to test this. Karma didn't throw any errors and it would render an empty table.

If you have any ideas let me know.

@vsgoulart vsgoulart changed the base branch from develop to main December 19, 2024 09:38
@vsgoulart vsgoulart force-pushed the 1337-validate-table-data branch from 67dcafc to cc6a696 Compare December 19, 2024 09:44
@vsgoulart vsgoulart merged commit 910f8e2 into main Dec 19, 2024
12 checks passed
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Dec 19, 2024
@vsgoulart vsgoulart deleted the 1337-validate-table-data branch December 19, 2024 16:29
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.

Invalid table data breaks form-js in editor mode
2 participants