Open History to see the last commit
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?.authChallengeId !== previous?.authChallengeId ||
9 next?.message !== previous?.message ||
10 next?.defaultValue !== previous?.defaultValue
11 ) {
12 return next?.defaultValue ?? "";
13 }
14 return draft;
15}