mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 11:08:12 +00:00
fix: cache invalidation
This commit is contained in:
@@ -110,6 +110,13 @@ export default function ContractClearanceDetailPage() {
|
|||||||
const { data: bookingMilestones, refetch: refetchBookingMilestones } =
|
const { data: bookingMilestones, refetch: refetchBookingMilestones } =
|
||||||
useBookingMilestones(linkedBookingId);
|
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) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<PageContainer>
|
<PageContainer>
|
||||||
@@ -261,7 +268,7 @@ export default function ContractClearanceDetailPage() {
|
|||||||
onChanged={() => {
|
onChanged={() => {
|
||||||
void refetch();
|
void refetch();
|
||||||
void refetchContract();
|
void refetchContract();
|
||||||
void refetchBookingMilestones();
|
refetchBookingMilestonesIfLinked();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
@@ -279,7 +286,7 @@ export default function ContractClearanceDetailPage() {
|
|||||||
roleMode="ET"
|
roleMode="ET"
|
||||||
onChanged={() => {
|
onChanged={() => {
|
||||||
void refetch();
|
void refetch();
|
||||||
void refetchBookingMilestones();
|
refetchBookingMilestonesIfLinked();
|
||||||
}}
|
}}
|
||||||
onViewFile={view}
|
onViewFile={view}
|
||||||
onDownloadFile={(f) => void downloadBookingFile(f.id, f.name)}
|
onDownloadFile={(f) => void downloadBookingFile(f.id, f.name)}
|
||||||
|
|||||||
@@ -105,6 +105,13 @@ export default function GlClearanceDetailPage() {
|
|||||||
const { data: bookingMilestones, refetch: refetchBookingMilestones } =
|
const { data: bookingMilestones, refetch: refetchBookingMilestones } =
|
||||||
useBookingMilestones(linkedBookingId);
|
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) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<PageContainer>
|
<PageContainer>
|
||||||
@@ -275,7 +282,7 @@ export default function GlClearanceDetailPage() {
|
|||||||
onUploadRoRequest={() => setUploadKind("ro")}
|
onUploadRoRequest={() => setUploadKind("ro")}
|
||||||
onChanged={() => {
|
onChanged={() => {
|
||||||
void refetch();
|
void refetch();
|
||||||
void refetchBookingMilestones();
|
refetchBookingMilestonesIfLinked();
|
||||||
}}
|
}}
|
||||||
onViewFile={view}
|
onViewFile={view}
|
||||||
onDownloadFile={(f) => void downloadBookingFile(f.id, f.name)}
|
onDownloadFile={(f) => void downloadBookingFile(f.id, f.name)}
|
||||||
|
|||||||
Reference in New Issue
Block a user