Code review template for React

A pull request review with a file list, a split or unified diff, line comments and live checks, styled by Graphite.

Start free 14-day trial

kestrel/fieldbook-web

Search waits for typing to pause and reuses recent results #482

Openines/search-debounceintomain

jk next and previous file

13 lines added, 2 removed1 open thread
Changes to src/components/search-field.module.css, old and new side by side
@@ -8,12 +8,26 @@
8 font-size: 0.875rem;8 font-size: 0.875rem;
9}9}
10​10​
11Removed: .field input {11Added: .control {
12Added: position: relative;
13Added: }
14Added: ​
15Added: .control input {
16 width: 100%;16 width: 100%;
13Removed: padding: 0.5rem 0.75rem;17Added: padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  1. Wen Hao3 h ago

    The 2.25rem leaves room for the spinner. Could it read the spinner size so the two stay in step?

18 border: 0.0625rem solid var(--line);18 border: 0.0625rem solid var(--line);
19 border-radius: 0.5rem;19 border-radius: 0.5rem;
20}20}
21​21​
22Added: .spinner {
23Added: position: absolute;
24Added: inset-block: 0;
25Added: right: 0.75rem;
26Added: margin-block: auto;
27Added: }
28Added: ​
29.results {29.results {
30 margin-top: 0.25rem;30 margin-top: 0.25rem;
12 lines added, 3 removed
Changes to src/components/search-field.tsx, old and new side by side
@@ -1,18 +1,27 @@
1import { useId, useState } from "react";1import { useId, useState } from "react";
2import { useSearch } from "../hooks/use-search";2import { useSearch } from "../hooks/use-search";
3Added: import { Spinner } from "./spinner";
4import styles from "./search-field.module.css";4import styles from "./search-field.module.css";
5​5​
6export function SearchField({ onPick }: { onPick: (id: string) => void }) {6export function SearchField({ onPick }: { onPick: (id: string) => void }) {
7 const id = useId();7 const id = useId();
8 const [query, setQuery] = useState("");8 const [query, setQuery] = useState("");
8Removed: const { hits } = useSearch(query);9Added: const { hits, loading } = useSearch(query);
10​10​
11 return (11 return (
11Removed: <div className={styles.field}>12Added: <div className={styles.field} aria-busy={loading}>
13 <label htmlFor={id}>Search notes</label>13 <label htmlFor={id}>Search notes</label>
13Removed: <input id={id} value={query} onChange={(e) => setQuery(e.target.value)} />14Added: <div className={styles.control}>
15Added: <input
16Added: id={id}
17Added: type="search"
18Added: value={query}
19Added: onChange={(e) => setQuery(e.target.value)}
20Added: />
21Added: {loading && <Spinner className={styles.spinner} label="Searching" />}
22Added: </div>
23 <ul className={styles.results}>23 <ul className={styles.results}>
24 {hits.map((hit) => (24 {hits.map((hit) => (
25 <li key={hit.id}>25 <li key={hit.id}>
28 lines added, 6 removed1 open thread
New18 lines added, 0 removed
Changes to src/hooks/use-search.test.ts, old and new side by side
@@ -0,0 +1,18 @@
1Added: import { act, renderHook } from "@testing-library/react";
2Added: import { afterEach, describe, expect, it, vi } from "vitest";
3Added: import * as api from "../api/notes";
4Added: import { useSearch } from "./use-search";
5Added: ​
6Added: describe("useSearch", () => {
7Added: afterEach(() => vi.useRealTimers());
8Added: ​
9Added: it("waits for typing to pause before it searches", async () => {
10Added: vi.useFakeTimers();
11Added: const search = vi.spyOn(api, "searchNotes").mockResolvedValue([]);
12Added: const { rerender } = renderHook(({ q }) => useSearch(q), { initialProps: { q: "ha" } });
13Added: rerender({ q: "harbour" });
14Added: await act(() => vi.advanceTimersByTimeAsync(200));
15Added: expect(search).toHaveBeenCalledTimes(1);
16Added: expect(search).toHaveBeenCalledWith("harbour", expect.anything());
17Added: });
18Added: });
New32 lines added, 0 removed
Changes to src/lib/query-cache.ts, old and new side by side
@@ -0,0 +1,33 @@
1Added: /** Keeps recent search results in memory, keyed by the trimmed, lower-case query. */
2Added: export interface CacheEntry<T> {
3Added: value: T;
4Added: storedAt: number;
5Added: }
6Added: ​
7Added: export function createQueryCache<T>({ limit = 20, ttlMs = 60_000 } = {}) {
8Added: const entries = new Map<string, CacheEntry<T>>();
9Added: const key = (query: string) => query.trim().toLowerCase();
10Added: ​
11Added: return {
12Added: get(query: string): T | undefined {
13Added: const hit = entries.get(key(query));
14Added: if (!hit) return undefined;
15Added: if (Date.now() - hit.storedAt > ttlMs) {
16Added: entries.delete(key(query));
17Added: return undefined;
18Added: }
19Added: return hit.value;
20Added: },
21Added: set(query: string, value: T) {
22Added: entries.delete(key(query));
23Added: entries.set(key(query), { value, storedAt: Date.now() });
24Added: if (entries.size > limit) {
25Added: // A Map keeps insertion order, so the first key is the oldest one.
26Added: const oldest = entries.keys().next().value;
Resolved: Tomás Reyes on line 26
27Added: if (oldest !== undefined) entries.delete(oldest);
28Added: }
29Added: },
30Added: clear: () => entries.clear(),
31Added: };
32Added: }

Built on the stack you already use

  • React
  • Next.js
  • TypeScript
  • Tailwind CSS
  • shadcn/ui
  • Radix UI

Everything the screen needs

  • Source you own

    Download the source with Pro. Every line lands in your repo.

  • Many design systems

    Switch the same layout between design systems that fit it, with no rewrite.

  • One theme for every screen

    Colors, corner radius and shadows come from CSS variables, so one change restyles it all.

  • Built by your agent

    Ask Claude Code, Cursor or Codex for this screen. The MCP gives it the system and the rules.

  • Checked before handoff

    Your agent reviews accessibility, spacing and copy against the review rules.

  • Interface only

    No database or sign-in wiring to remove. Connect the data you already have.

Free to build. Pay for your own brand.

Limited

For individual builders.

$0forever

No card required

300 tool calls a month

  • Everything in Pro
  • Not included: Templates
  • Not included: GitHub PR reviews
Use the free plan

Pro

For builders who ship every day.

$24/ month

Billed monthly after the trial.

Unlimited tool calls

  • Your brand guidelines, kept private, applied to every build
  • Design systems
  • Slides
  • Illustrations
  • Video
  • Mobile tools
  • 3D tools
  • Shopify tools
  • Templates
  • GitHub PR reviews

Agency & Enterprise

One private brand for every client, product, or business unit.

Custompricing

Scope and price follow the call.
  • Everything in Pro
  • A separate private brand for every client or business unit
  • White label under your own name
  • We set it up with you
Book a demo

Questions

What is in the Code review template?

A pull request review with a file list, a split or unified diff, line comments and live checks. Every part is a shadcn-compatible component you can edit.

Is it free?

Looking is free, and so is asking your coding agent to build this screen on the free Limited plan. Downloading the source comes with Pro, from $20 a month billed yearly, and the 14-day trial counts.

How do I install it?

On Pro, download the zip from this page and follow its README. On any plan, run npx better-design to connect your coding agent, then ask it for the Code review screen.

Which design system should I pick?

Start with Precision Light, the default for this layout. The switcher lists the others that fit it.

Can it use my own brand?

Yes, on Pro. Your agent applies your private brand guidelines to every screen it builds.

Does it include a backend?

No. The template is the interface only, so you connect your own data and sign-in.

Built with Better Design.

FIFA World Cup 26 bracket

A live radial knockout bracket with animated paths, match details, and an interactive 3D trophy.

TodoGit

A Git-based task manager for people and their coding agents, built around fast keyboard workflows.

Coffee World

A liquid glass photo carousel: an endless curved grid of refracting glass slabs, rendered in a single WebGL2 shader.