Open History to see the last commit
1import { useCommitOnBlur } from "~/hooks/useCommitOnBlur";
2import { Input, type InputProps } from "./input";
3
4export type DraftInputProps = Omit<InputProps, "value" | "onChange" | "defaultValue"> & {
5 readonly value: string;
6 readonly onCommit: (next: string) => void;
7};
8
9/** Commit drafts without settings-wide rerenders or server round trips per keystroke. */
10export function DraftInput({ value, onCommit, ...rest }: DraftInputProps) {
11 const bag = useCommitOnBlur(value, onCommit);
12 return <Input {...rest} {...bag} />;
13}