Skip to content

Commit

Permalink
Merge pull request #1006 from Enterprise-CMCS/main
Browse files Browse the repository at this point in the history
Release to val
  • Loading branch information
13bfrancis authored Jan 10, 2025
2 parents 6659c62 + 8982d92 commit a5fb2e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
24 changes: 13 additions & 11 deletions lib/packages/shared-types/opensearch/main/transforms/seatool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ const getRaiDate = (data: SeaTool) => {
const getDateStringOrNullFromEpoc = (epocDate: number | null | undefined) =>
epocDate !== null && epocDate !== undefined ? new Date(epocDate).toISOString() : null;

const compileSrtList = (
officers: SeatoolOfficer[] | null | undefined,
): { name: string; email: string }[] =>
officers?.length
? officers.map((o) => ({
name: `${o.FIRST_NAME || ""} ${o.LAST_NAME || ""}`,
email: o.EMAIL || "",
}))
: [];
const compileSrtList = (
officers: SeatoolOfficer[] | null | undefined,
): { name: string; email: string }[] =>
officers?.length
? officers.map((o) => ({
name: `${o.FIRST_NAME || ""} ${o.LAST_NAME || ""}`,
email: o.EMAIL || "",
}))
: [];

const getFinalDispositionDate = (status: string, record: SeaTool) => {
return status && finalDispositionStatuses.includes(status)
Expand Down Expand Up @@ -124,11 +124,13 @@ export const transform = (id: string) => {
: null;

const { stateStatus, cmsStatus } = getStatus(seatoolStatus);

const resp = {
id,
id: id.toUpperCase(),
actionType: data.ACTIONTYPES?.[0].ACTION_NAME,
approvedEffectiveDate: getDateStringOrNullFromEpoc(
data.STATE_PLAN.APPROVED_EFFECTIVE_DATE || data.STATE_PLAN.ACTUAL_EFFECTIVE_DATE,
data.STATE_PLAN.APPROVED_EFFECTIVE_DATE ||
data.STATE_PLAN.ACTUAL_EFFECTIVE_DATE,
),
changed_date: data.STATE_PLAN.CHANGED_DATE,
description: data.STATE_PLAN.SUMMARY_MEMO,
Expand Down
5 changes: 2 additions & 3 deletions react-app/src/components/ActionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ export const ActionForm = <Schema extends SchemaWithEnforcableProps>({
API.post("os", "/submit", {
body: formData,
}),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["record"] });
},
});

const onSubmit = form.handleSubmit(async (formData) => {
Expand Down Expand Up @@ -174,6 +171,8 @@ export const ActionForm = <Schema extends SchemaWithEnforcableProps>({
pathnameToDisplayOn: formOrigins.pathname,
});

// Prevent stale data from displaying on formOrigins page
await queryClient.invalidateQueries({ queryKey: ["record"] });
navigate(formOrigins);
} catch (error) {
console.error(error);
Expand Down

0 comments on commit a5fb2e2

Please sign in to comment.