Merge pull request #724 from Tria-plc/freight/feat/fixes-v1

Freight/feat/fixes v1
This commit is contained in:
Nathnael Wondisha
2026-07-16 10:59:36 +03:00
committed by GitHub
3 changed files with 34 additions and 20 deletions

View File

@@ -110,6 +110,13 @@ export default function ContractClearanceDetailPage() {
const { data: bookingMilestones, refetch: refetchBookingMilestones } =
useBookingMilestones(linkedBookingId);
// react-query's imperative refetch() ignores `enabled`, so calling it while
// linkedBookingId is still undefined (pre-booking clearance) would fire
// GET /contracts/bookings/undefined/milestones → 400 (uuid expected). Guard it.
const refetchBookingMilestonesIfLinked = () => {
if (linkedBookingId) void refetchBookingMilestones();
};
if (isLoading) {
return (
<PageContainer>
@@ -261,7 +268,7 @@ export default function ContractClearanceDetailPage() {
onChanged={() => {
void refetch();
void refetchContract();
void refetchBookingMilestones();
refetchBookingMilestonesIfLinked();
}}
/>
</Grid.Col>
@@ -279,7 +286,7 @@ export default function ContractClearanceDetailPage() {
roleMode="ET"
onChanged={() => {
void refetch();
void refetchBookingMilestones();
refetchBookingMilestonesIfLinked();
}}
onViewFile={view}
onDownloadFile={(f) => void downloadBookingFile(f.id, f.name)}

View File

@@ -105,6 +105,13 @@ export default function GlClearanceDetailPage() {
const { data: bookingMilestones, refetch: refetchBookingMilestones } =
useBookingMilestones(linkedBookingId);
// react-query's imperative refetch() ignores `enabled`, so calling it while
// linkedBookingId is still undefined (pre-booking clearance) would fire
// GET /contracts/bookings/undefined/milestones → 400 (uuid expected). Guard it.
const refetchBookingMilestonesIfLinked = () => {
if (linkedBookingId) void refetchBookingMilestones();
};
if (isLoading) {
return (
<PageContainer>
@@ -275,7 +282,7 @@ export default function GlClearanceDetailPage() {
onUploadRoRequest={() => setUploadKind("ro")}
onChanged={() => {
void refetch();
void refetchBookingMilestones();
refetchBookingMilestonesIfLinked();
}}
onViewFile={view}
onDownloadFile={(f) => void downloadBookingFile(f.id, f.name)}