Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

previewPromptText.ts

15 lines491 Bytes

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;