feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Fixes to Caching of allocations summary

This commit is contained in:
Dave
2025-11-28 11:29:48 -05:00
parent d885bac7d0
commit c1e3c08652
6 changed files with 93 additions and 31 deletions

View File

@@ -51,7 +51,7 @@ function normalizeJobAllocations(ack) {
* is now done on the backend via buildRogogFromAllocations/buildRolaborFromRogog.
* This component just renders the preview from `ack.rogg` / `ack.rolabor`.
*/
export function RrAllocationsSummary({ socket, bodyshop, jobId, title }) {
export function RrAllocationsSummary({ socket, bodyshop, jobId, title, onAllocationsChange }) {
const { t } = useTranslation();
const [roggPreview, setRoggPreview] = useState(null);
const [rolaborPreview, setRolaborPreview] = useState(null);
@@ -70,6 +70,9 @@ export function RrAllocationsSummary({ socket, bodyshop, jobId, title }) {
socket.allocationsSummary = [];
socket.rrAllocationsRaw = ack;
}
if (onAllocationsChange) {
onAllocationsChange([]);
}
return;
}
@@ -83,6 +86,9 @@ export function RrAllocationsSummary({ socket, bodyshop, jobId, title }) {
socket.allocationsSummary = jobAllocRows;
socket.rrAllocationsRaw = ack;
}
if (onAllocationsChange) {
onAllocationsChange(jobAllocRows);
}
});
} catch {
setRoggPreview(null);
@@ -91,8 +97,11 @@ export function RrAllocationsSummary({ socket, bodyshop, jobId, title }) {
if (socket) {
socket.allocationsSummary = [];
}
if (onAllocationsChange) {
onAllocationsChange([]);
}
}
}, [socket, jobId, t]);
}, [socket, jobId, t, onAllocationsChange]);
useEffect(() => {
fetchAllocations();