feature/IO-3499-React-19: Bug Fixes / Checkpoint
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Alert, Button, Card, Table, Typography } from "antd";
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useCallback, useEffect, useState, useRef } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -31,6 +31,11 @@ export default connect(mapStateToProps, mapDispatchToProps)(DmsAllocationsSummar
|
||||
export function DmsAllocationsSummary({ mode, socket, bodyshop, jobId, title, onAllocationsChange }) {
|
||||
const { t } = useTranslation();
|
||||
const [allocationsSummary, setAllocationsSummary] = useState([]);
|
||||
const socketRef = useRef(socket);
|
||||
|
||||
useEffect(() => {
|
||||
socketRef.current = socket;
|
||||
}, [socket]);
|
||||
|
||||
// Resolve event name by mode (PBS reuses the CDK event per existing behavior)
|
||||
const allocationsEvent =
|
||||
@@ -48,14 +53,14 @@ export function DmsAllocationsSummary({ mode, socket, bodyshop, jobId, title, on
|
||||
const list = Array.isArray(ack) ? ack : [];
|
||||
setAllocationsSummary(list);
|
||||
// Preserve side-channel used by the post form for discrepancy checks
|
||||
socket.allocationsSummary = list;
|
||||
socketRef.current.allocationsSummary = list;
|
||||
if (onAllocationsChange) onAllocationsChange(list);
|
||||
});
|
||||
} catch {
|
||||
// Best-effort; leave table empty on error
|
||||
setAllocationsSummary([]);
|
||||
if (socket) {
|
||||
socket.allocationsSummary = [];
|
||||
if (socketRef.current) {
|
||||
socketRef.current.allocationsSummary = [];
|
||||
}
|
||||
if (onAllocationsChange) {
|
||||
onAllocationsChange([]);
|
||||
|
||||
Reference in New Issue
Block a user