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

Improve errors in Chart component #3262

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

apedroferreira
Copy link
Member

@apedroferreira apedroferreira commented Feb 29, 2024

While looking a bit into propagating query errors to component binding results, ran into some semi-related issues in charts.

Edit: I moved this back into draft as I thought the fix wouldn't break any tests but it does. This logic is a bit complicated, I wasn't able to find a good solution so far / get to the root of the issue.

Before:

  • Charts example was showing errors in some charts before loading
Screen.Recording.2024-02-29.at.18.55.14.mov

After:

  • Charts load without errors
Screen.Recording.2024-02-29.at.18.56.18.mov

@apedroferreira apedroferreira added the bug 🐛 Something doesn't work label Feb 29, 2024
@apedroferreira apedroferreira self-assigned this Feb 29, 2024
@@ -171,12 +171,12 @@ export default function evalJsBindings(
if (expression) {
const computed = computationStatuses.get(expression);
if (computed) {
if (computed.result) {
if (!computed.result) {
Copy link
Member Author

@apedroferreira apedroferreira Feb 29, 2024

Choose a reason for hiding this comment

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

The reason why some charts were showing errors before loading was because they were using a cached result here, but using this result didn't let them recognize that the query was still loading.
I changed it to not use the cache if there is an error in the result. There's probably a better solution?

@apedroferreira apedroferreira marked this pull request as ready for review February 29, 2024 19:03
@@ -171,8 +171,8 @@ function Chart({ data = [], loading, error, sx }: ChartProps) {

return (
<Box sx={{ ...sx, position: 'relative', height: '100%', width: '100%' }} aria-busy={loading}>
{displayError ? <ErrorOverlay error={displayError} /> : null}
{loading && !error ? (
{displayError && !loading ? <ErrorOverlay error={displayError} /> : null}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is just an adjustment, doesn't address any of the reported issues in this PR.

@apedroferreira apedroferreira changed the title Improve errors in Chart and DataGrid components Improve errors in Chart component Feb 29, 2024
@apedroferreira apedroferreira requested review from a team and removed request for a team February 29, 2024 19:12
@apedroferreira apedroferreira marked this pull request as draft February 29, 2024 19:16
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant