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: suspend table and related charts #236

Merged
merged 1 commit into from
May 14, 2024
Merged

feat: suspend table and related charts #236

merged 1 commit into from
May 14, 2024

Conversation

duyet
Copy link
Owner

@duyet duyet commented May 14, 2024

No description provided.

Copy link

vercel bot commented May 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clickhouse-monitoring ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2024 5:44am

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @duyet - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines +33 to 42
return (
<div className="flex flex-col">
<Suspense fallback={<ChartSkeleton />}>
<RelatedCharts relatedCharts={config.relatedCharts} />
</Suspense>

<DataTable
<Suspense fallback={<TableSkeleton />}>
<Table
title={query.replaceAll('-', ' ')}
config={config}
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Consider handling errors within the new Page component.

The refactored Page component lacks error handling which was previously managed by a try-catch block. It's important to ensure that errors from the Table component or related processes are caught and handled appropriately to maintain robustness.

Comment on lines +37 to +46
</Suspense>

<DataTable
<Suspense fallback={<TableSkeleton />}>
<Table
title={query.replaceAll('-', ' ')}
config={config}
data={data}
searchParams={searchParams}
/>
</div>
)
} catch (error) {
return <ErrorAlert title="ClickHouse Error" message={`${error}`} />
}
</Suspense>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Review the use of Suspense for error boundaries or alternative error handling strategies.

While Suspense is used for handling the loading state, consider implementing error boundaries or similar strategies to handle errors that might occur during the rendering of asynchronous components.

@@ -0,0 +1,71 @@
import { DataTable } from '@/components/data-table/data-table'
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Check for potential duplication of DataTable component usage.

As the DataTable component is now used within the Table component, ensure there's no redundant usage or similar components that could be consolidated to streamline the codebase.

Suggested change
import { DataTable } from '@/components/data-table/data-table'
import { Table } from '@/components/table'

}
}

let sql = config.sql
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (code-quality): Prefer object destructuring when accessing and using properties. (use-object-destructuring)

Suggested change
let sql = config.sql
let {sql} = config


ExplanationObject destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.

From the Airbnb Javascript Style Guide

@duyet duyet merged commit 8ad8a9e into main May 14, 2024
14 checks passed
@duyet duyet deleted the chore/ui branch May 14, 2024 05:56
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.

1 participant