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: ssr search #164

Merged
merged 6 commits into from
Apr 11, 2024
Merged

feat: ssr search #164

merged 6 commits into from
Apr 11, 2024

Conversation

gaboesquivel
Copy link
Member

@gaboesquivel gaboesquivel commented Apr 11, 2024

closes #118
related #160 #162

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a SearchInput component across various pages for enhanced search functionality.
    • Added a new HomePage component that utilizes search parameters for dynamic content rendering.
    • Launched new utility functions for URL and username handling.
  • Enhancements

    • Simplified the layout structure by removing the BrowseProvider component across multiple components.
    • Upgraded search capabilities in the ChatSearchInput and ThreadList components.
  • Bug Fixes

    • Corrected import paths for types and services related to chat functionalities.
  • Refactor

    • Removed deprecated props and hooks such as activeTab and useBrowse from components.
    • Updated parameter naming from keyword to query to unify search-related functionalities.

Copy link

vercel bot commented Apr 11, 2024

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

Name Status Preview Comments Updated (UTC)
masterbots ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2024 11:46pm

Copy link
Contributor

coderabbitai bot commented Apr 11, 2024

Walkthrough

The changes in this update revamp the search functionality within Masterbots.ai, enhancing user experience and system efficiency. By replacing components, refining layouts, and updating functionalities, the platform aims to offer a more seamless browsing and searching experience across various sections.

Changes

File Path Change Summary
.../app/(browse)/..., .../app/u/[slug]/page.tsx Replaced BrowseInput with SearchInput for improved browsing and searching.
.../app/(browse)/page.tsx Added HomePage component, updated ThreadList with query-based filtering.
.../app/b/[id]/layout.tsx, .../app/u/layout.tsx, .../app/c/layout.tsx Removed BrowseProvider, simplified layout structures.
.../components/routes/c/..., .../components/shared/... Updated import paths, modified search input components and dialog functionalities.
.../components/shared/category-tabs/category-link.tsx, .../components/shared/category-tabs/category-tabs.tsx Simplified rendering logic, removed unnecessary props and event handling.
.../components/shared/thread-list.tsx Refactored state management, updated JSX structure, and replaced object types.
.../lib/number.ts, .../lib/url.ts, .../lib/username.ts Introduced utility functions for random number generation, URL operations, and username handling.
.../services/hasura/hasura.service.ts, .../services/hasura/hasura.service.type.ts Renamed keyword to query in service functions and interfaces.
.../404/page.tsx Added NotFoundPage function for rendering "NOT Found" message.

Possibly related issues

  • SSR Search part 1 #118: The enhancements align with optimizing server-side rendering for search results, potentially boosting SEO and performance for Masterbots.ai.

Poem

"In the realm of code and query, 🐇💻
Changes dance, merry and airy.
Search evolves, components unite,
A digital symphony, shining bright.
Masterbots.ai, a new spark to ignite,
With each update, a future in sight."


Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b961d22 and 2d11d62.
Files ignored due to path filters (1)
  • bun.lockb is excluded by !bun.lockb
Files selected for processing (1)
  • apps/masterbots.ai/components/shared/thread-list.tsx (3 hunks)
Additional comments not posted (8)
apps/masterbots.ai/components/shared/thread-list.tsx (8)

8-10: The addition of usePathname and useSearchParams aligns well with the PR's focus on enhancing search functionality. Good use of modern hooks for managing search parameters.


19-20: The setup of searchParams and queryKey is well-implemented. It ensures that the component responds dynamically to changes in the URL's search parameters, which is essential for a search-driven feature.


22-38: The implementation of useQuery for fetching threads based on search parameters is robust. It correctly handles pagination and initial data setup, which are crucial for performance and user experience.


44-47: The updated intersection observer setup, which directly calls threads.refetch() without a setTimeout, is a good improvement. It makes the refetching process more immediate and responsive.


54-57: Proper cleanup of the intersection observer in the useEffect cleanup function is crucial for avoiding memory leaks. Well done on ensuring resources are properly managed.


64-69: Using the queryKey as the key for the main container is an excellent choice for handling re-renders triggered by search parameter changes. This approach is particularly effective in managing SSR and hydration issues.


70-72: The use of thread.threadId as the key in the map function is a good practice, ensuring that each component maintains its identity across re-renders. This is crucial for performance optimization in React.


88-88: Changing the filter prop type to GetBrowseThreadsParams enhances type safety and makes the component's API clearer and more predictable. Good job on improving the code quality.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Apr 11, 2024

⚡️ Lighthouse report

Page: https://masterbots-76x3t5fg6-bitcash.vercel.app/
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1712879573621-656.report.html

Category Score
🔴 Performance 46
🟢 Accessibility 96
🟠 Best practices 78
🟠 SEO 85
🔴 PWA 38

Page: https://masterbots-76x3t5fg6-bitcash.vercel.app/b/moneybot
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1712879573940-10201.report.html

Category Score
🟠 Performance 55
🟢 Accessibility 96
🟠 Best practices 78
🟠 SEO 85
🔴 PWA 38

Page: https://masterbots-76x3t5fg6-bitcash.vercel.app/u/slug-1
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1712879574265-28797.report.html

Category Score
🟠 Performance 58
🟢 Accessibility 94
🟠 Best practices 78
🟠 SEO 83
🔴 PWA 38

Page: https://masterbots-76x3t5fg6-bitcash.vercel.app/p
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1712879574788-60714.report.html

Category Score
🟠 Performance 89
🟢 Accessibility 92
🟠 Best practices 78
🟠 SEO 76
🔴 PWA 38

Page: https://masterbots-76x3t5fg6-bitcash.vercel.app/health
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1712879575116-70237.report.html

Category Score
🟠 Performance 87
🟠 Accessibility 59
🟠 Best practices 74
🔴 SEO 42
🔴 PWA 13

Page: https://masterbots-76x3t5fg6-bitcash.vercel.app/health/a8103808-14a3-48ed-aa5a-9e490cfdcf0e
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1712879575509-7165.report.html

Category Score
🟠 Performance 88
🟠 Accessibility 59
🟠 Best practices 74
🔴 SEO 42
🔴 PWA 13

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

apps/masterbots.ai/lib/number.ts Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

apps/masterbots.ai/components/shared/thread-list.tsx Outdated Show resolved Hide resolved
apps/masterbots.ai/components/shared/thread-list.tsx Outdated Show resolved Hide resolved
@gaboesquivel gaboesquivel merged commit 39d6372 into alpha Apr 11, 2024
3 of 4 checks passed
@gaboesquivel gaboesquivel deleted the chore-ssr-search branch April 11, 2024 23:45
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.

SSR Search part 1
1 participant