1import type { PreviewStreamControl } from "@t3tools/client-runtime/preview/server-browser-stream";
2
3type Dialog = PreviewStreamControl["dialog"];
4
5export function previewPromptText(previous: Dialog, next: Dialog, draft: string) {
6 if (
7 next?.type !== previous?.type ||
8 next?.message !== previous?.message ||
9 next?.defaultValue !== previous?.defaultValue
10 ) {
11 return next?.defaultValue ?? "";
12 }
13 return draft;
14}