690329:2252 Fixing refactor Correspondence GPT-5.3-Codex #05
CI / CD Pipeline / build (push) Successful in 22m17s
CI / CD Pipeline / deploy (push) Successful in 7m49s

This commit is contained in:
2026-03-29 22:52:42 +07:00
parent abbdebf2b9
commit 1c6fec6c65
13 changed files with 485 additions and 4 deletions
+12 -2
View File
@@ -25,6 +25,15 @@ interface CorrespondenceDetailProps {
selectedRevisionId?: string;
}
const normalizeUuid = (value?: string): string | undefined => {
if (typeof value !== 'string') {
return undefined;
}
const normalized = value.trim().toLowerCase();
return normalized.length > 0 ? normalized : undefined;
};
export function CorrespondenceDetail({ data, selectedRevisionId }: CorrespondenceDetailProps) {
const submitMutation = useSubmitCorrespondence();
const processMutation = useProcessWorkflow();
@@ -36,8 +45,9 @@ export function CorrespondenceDetail({ data, selectedRevisionId }: Correspondenc
if (!data) return <div>No data found</div>;
const selectedRevision = selectedRevisionId
? data.revisions?.find((r) => r.publicId === selectedRevisionId)
const normalizedSelectedRevisionId = normalizeUuid(selectedRevisionId);
const selectedRevision = normalizedSelectedRevisionId
? data.revisions?.find((r) => normalizeUuid(r.publicId) === normalizedSelectedRevisionId)
: undefined;
const currentRevision = selectedRevision || data.revisions?.find((r) => r.isCurrent) || data.revisions?.[0];
const subject = currentRevision?.subject || '-';
+8 -2
View File
@@ -125,6 +125,11 @@ const normalizePublicId = (value: unknown): string | undefined => {
return trimmed.length > 0 ? trimmed : undefined;
};
const normalizeUuid = (value: unknown): string | undefined => {
const normalized = normalizePublicId(value);
return normalized ? normalized.toLowerCase() : undefined;
};
export function CorrespondenceForm({
initialData,
uuid,
@@ -147,8 +152,9 @@ export function CorrespondenceForm({
const correspondenceTypes = extractArrayData<CorrespondenceTypeOption>(correspondenceTypesData);
// Extract initial values if editing
const selectedRevision = selectedRevisionId
? initialData?.revisions?.find((r) => normalizePublicId(r.publicId) === selectedRevisionId)
const normalizedSelectedRevisionId = normalizeUuid(selectedRevisionId);
const selectedRevision = normalizedSelectedRevisionId
? initialData?.revisions?.find((r) => normalizeUuid(r.publicId) === normalizedSelectedRevisionId)
: undefined;
const currentRev = selectedRevision || initialData?.revisions?.find((r) => r.isCurrent) || initialData?.revisions?.[0];
const initialToRecipient = initialData?.recipients?.find((r) => r.recipientType === 'TO');