Skip to content

Open-source, local-first AI agent for real work.

447 B
Raw Blame
import { useSyncExternalStore } from "react";
import type { TurnReview } from "../git/turnReview";
import { getTurnReview, subscribeTurnReviews } from "../git/turnReview";

/** The last turn's review for a cwd, re-rendering whenever it changes. */
export function useTurnReview(cwd: string | null | undefined): TurnReview | null {
	return useSyncExternalStore(
		subscribeTurnReviews,
		() => getTurnReview(cwd),
		() => getTurnReview(cwd),
	);
}