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(ui): async display host status and database list breadcrumb skeleton #257

Merged
merged 2 commits into from
May 28, 2024

Conversation

duyet
Copy link
Owner

@duyet duyet commented May 28, 2024

No description provided.

Copy link

vercel bot commented May 28, 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 28, 2024 7:49am

@duyet duyet changed the title feat(ui): async display host status feat(ui): async display host status and database list breadcrumb skeleton May 28, 2024
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 found some issues that need to be addressed.

Blocking issues:

  • Suspense component requires a fallback (link)
Here's what I looked at during the review
  • 🔴 General issues: 1 blocking issue, 4 other issues
  • 🟢 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.

import { fetchData, getClickHouseHosts } from '@/lib/clickhouse'
import { getHost } from '@/lib/utils'
import { Suspense } from 'react'
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (performance): Consider lazy loading HostStatus component

Since you are using Suspense, it might be beneficial to lazy load the HostStatus component to improve initial load performance.

Suggested change
import { Suspense } from 'react'
import { Suspense, lazy } from 'react'
const HostStatus = lazy(() => import('@/components/HostStatus'))

<span className="absolute inline-flex size-full animate-ping rounded-full bg-sky-400 opacity-75"></span>
<span className="relative inline-flex size-2 rounded-full bg-sky-500"></span>
</span>
const Online = ({ title }: { title: string }) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (performance): Consider memoizing Online component

If the Online component is rendered frequently, consider memoizing it using React.memo to avoid unnecessary re-renders.

Suggested change
const Online = ({ title }: { title: string }) => (
import React, { memo } from 'react';
const Online = memo(({ title }: { title: string }) => (

<span className="relative flex size-2">
<span className="absolute inline-flex size-full rounded-full bg-red-400"></span>
</span>
const Offline = ({ title }: { title: string }) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (performance): Consider memoizing Offline component

If the Offline component is rendered frequently, consider memoizing it using React.memo to avoid unnecessary re-renders.

Suggested change
const Offline = ({ title }: { title: string }) => (
import React, { memo } from 'react';
const Offline = memo(({ title }: { title: string }) => (
<TooltipProvider delayDuration={0}>
<Tooltip>

@@ -55,7 +76,10 @@ export async function ClickHouseHost() {
if (hosts.length === 1) {
return (
<div className="flex flex-row items-center gap-2">
<HostStatus host={hosts[0]} />
{getHost(hosts[0])}
<Suspense>
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: Suspense component requires a fallback

The Suspense component should have a fallback prop to display a loading indicator or message while the HostStatus component is being loaded.

<MenuNavigationStyle className="hidden md:flex" items={items} />
<MenuDropdownStyle className="flex md:hidden" items={items} />
<MenuNavigationStyle
className="hidden transition md:flex"
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 specifying transition properties

The 'transition' class is added, but no specific transition properties are defined. Consider specifying which properties should transition for better clarity and control.

Suggested change
className="hidden transition md:flex"
className="hidden transition-all duration-300 md:flex"

@duyet duyet merged commit 5d4e4c4 into main May 28, 2024
10 checks passed
@duyet duyet deleted the chore/ui branch May 28, 2024 07:55
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