Company
Date Published
Author
-
Word count
1855
Language
English
Hacker News points
None

Summary

Grep is an extremely fast code search tool that allows users to search over a million repositories for specific code snippets, files, or paths. Originally built with Create React App (CRA), Grep was updated to Next.js for improved performance and maintainability. The new implementation uses Next.js' server-side rendering capabilities to prerender the majority of the page, enabling quick navigations between subsequent pages while maintaining a fast initial page load. A search input is made interactive by conditionally rendering two references to the search input and synchronizing their state through URL-based state management. The search results are displayed instantly on the client-side using React Server Components, TanStack Query's `useSuspenseQuery`, and incremental client-side fetching with debouncing input changes. Optimistic UI updates and query caching help prevent stale or out-of-order results during rapid typing. Partial Prerendering enables faster initial loads without refactoring, combining static prerendering with dynamic streaming. The updated Grep experience offers instant search, persistent focus, optimized data fetching, improved performance, and enhanced features like dark mode and expanded search index. With this new foundation established, further improvements are being explored, including private repository indexing and advanced query syntax.