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

feat(data-exploration): improve data table crashes #13806

Merged
merged 27 commits into from
Jan 20, 2023

Conversation

mariusandra
Copy link
Collaborator

Problem

The data exploration table would crash in weird ways when adding columns that didn't make sense. You'd have to go and edit the query to recover from this state:

2023-01-19 10 15 33

Changes

Now it either shows a full page "Error", or then uses a antd Tag to show the error in the table.

2023-01-19 10 09 37

The error component is stolen from insights. I also added a "no results" message, again from insights:

image

Out of scope

There's a separate PR out that exposes the actual errors themselves to the users:

#13703

This PR wants to do the minimum work in order to let the users recover from a common scenario of "I added faulty hogql, how do I recover?".

How did you test this code?

Made it crash.

Base automatically changed from hogql-small-refactor to master January 19, 2023 10:17
if (value === loadingColumn) {
return <Spinner />
} else if (value === errorColumn) {
return <Tag color="red">Error</Tag>
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're giving me extra work 😄 Why not LemonTag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't find it 🤪

image

(highlightedRows) =>
(row: any[]): boolean =>
row
? highlightedRows.has('__originalResultRow' in row ? (row as any).__originalResultRow : row)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we add __originalResultRow to the type?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense. Converted all the results to DataTableRow-s and it was as if all the windows were opened and light could finally shine through.

}
}
}
return response && 'results' in response ? (response as any).results ?? null : null
},
],
isRowHighlighted: [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm I can't quite grasp the purpose of this highlighting from the code. Can you add a one-line comment explaining what rows we want highlighted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The row data structure refactor removed the need for this proxying. yeet!

Copy link
Collaborator

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

Noticed a slightly weird thing UX-wise:
If I first add an invalid expression column (e.g. !!!) and then a valid one (e.g. properties.$geoip_country_code), both will show up as "Error"ing. And even when I delete the invalid one, the valid one will still be all "Error"s. If we could somehow determine which column is the offending one, this would be more intuitive.
Can we do this easily, considering we already catch problems like the column not existing in property_access_to_clickhouse, or would that be overkill for now?

@mariusandra
Copy link
Collaborator Author

mariusandra commented Jan 20, 2023

I went for a slightly simpler solution for now: just remove the results when we have an error. This also makes it easier to actually show errors when they occur.

2023-01-20 10 25 48

Copy link
Collaborator

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

Let's do this

@mariusandra mariusandra enabled auto-merge (squash) January 20, 2023 10:00
@mariusandra mariusandra merged commit b323490 into master Jan 20, 2023
@mariusandra mariusandra deleted the data-table-crash-detection branch January 20, 2023 10:49
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