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: /database page redirect invalid database to the first one existing #295

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

duyet
Copy link
Owner

@duyet duyet commented Jul 19, 2024

Summary by Sourcery

This pull request introduces a feature that redirects users to the first existing database if the specified database is invalid on the /database page. Additionally, it enhances the database query by changing the join type from left join to inner join for improved accuracy in fetching database names and table counts.

  • New Features:
    • Added a redirect to the first existing database if the current database is invalid on the /database page.
  • Enhancements:
    • Updated the database query to use an inner join instead of a left join for fetching database names and table counts.

Copy link

vercel bot commented Jul 19, 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 Jul 19, 2024 3:29pm

Copy link
Contributor

sourcery-ai bot commented Jul 19, 2024

Reviewer's Guide by Sourcery

This pull request introduces a feature to redirect users to the first existing database if the specified database is invalid. The changes include modifying the database fetching logic to include caching settings, handling errors more robustly, and updating the database query to use an inner join instead of a left join.

File-Level Changes

Files Changes
app/database/[database]/breadcrumb.tsx
app/database/queries.ts
Implemented a redirect to the first existing database if the current database is invalid and optimized the database query.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

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: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: 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.

}

// Current database not found in database list
if (!databases.find((db) => db.name === database)) {
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 using Array.prototype.some for better readability.

Using Array.prototype.some can make the intent clearer when checking if any database matches the current database name.

Suggested change
if (!databases.find((db) => db.name === database)) {
if (!databases.some((db) => db.name === database)) {

@duyet duyet merged commit 12f1726 into main Jul 19, 2024
16 checks passed
@duyet duyet deleted the chore/ui branch July 19, 2024 15:34
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