Skip to content

Commit 5afa8c0

Browse files
committed
Fixes #38709 - Fix hosts job status stuck in "Pending"
1 parent 420c8be commit 5afa8c0

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

webpack/JobInvocationDetail/JobInvocationHostTable.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const JobInvocationHostTable = ({
4747
onFilterUpdate,
4848
statusLabel,
4949
targeting,
50+
refreshTrigger,
5051
}) => {
5152
const columns = Columns();
5253
const columnNamesKeys = Object.keys(columns);
@@ -141,12 +142,17 @@ const JobInvocationHostTable = ({
141142
}, [allResponse]);
142143

143144
useEffect(() => {
144-
if (statusLabel !== prevStatusLabel.current) {
145-
setAPIOptions(prevOptions => ({ ...prevOptions }));
146-
prevStatusLabel.current = statusLabel;
145+
if (refreshTrigger > 0) {
146+
setAPIOptions(prev => ({
147+
...prev,
148+
params: { ...prev.params, _refresh: Date.now() }
149+
}));
150+
setAllAPIOptions(prev => ({
151+
...prev,
152+
params: { ...prev.params, _refresh: Date.now() }
153+
}));
147154
}
148-
// eslint-disable-next-line react-hooks/exhaustive-deps
149-
}, [statusLabel]);
155+
}, [refreshTrigger, setAPIOptions, setAllAPIOptions]);
150156

151157
const {
152158
updateSearchQuery: updateSearchQueryBulk,
@@ -443,11 +449,12 @@ JobInvocationHostTable.propTypes = {
443449
initialFilter: PropTypes.string.isRequired,
444450
statusLabel: PropTypes.string,
445451
onFilterUpdate: PropTypes.func,
452+
refreshTrigger: PropTypes.number,
446453
};
447454

448455
JobInvocationHostTable.defaultProps = {
449456
onFilterUpdate: () => {},
450-
statusLabel: undefined,
457+
refreshTrigger: 0,
451458
};
452459

453460
export default JobInvocationHostTable;

webpack/JobInvocationDetail/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const JobInvocationDetailPage = ({
5555
key: CURRENT_PERMISSIONS,
5656
});
5757
const [selectedFilter, setSelectedFilter] = useState('');
58+
const [refreshTrigger, setRefreshTrigger] = useState(0);
5859

5960
const handleFilterChange = newFilter => {
6061
setSelectedFilter(newFilter);
@@ -82,6 +83,12 @@ const JobInvocationDetailPage = ({
8283
// eslint-disable-next-line react-hooks/exhaustive-deps
8384
}, [dispatch, id, finished, autoRefresh]);
8485

86+
useEffect(() => {
87+
if (finished && !autoRefresh) {
88+
setRefreshTrigger(prev => prev + 1);
89+
}
90+
}, [finished, autoRefresh]);
91+
8592
useEffect(() => {
8693
if (task?.id !== undefined) {
8794
dispatch(getTask(`${task?.id}`));
@@ -187,6 +194,7 @@ const JobInvocationDetailPage = ({
187194
initialFilter={selectedFilter}
188195
statusLabel={statusLabel}
189196
onFilterUpdate={handleFilterChange}
197+
refreshTrigger={refreshTrigger}
190198
/>
191199
</SkeletonLoader>
192200
</PageSection>

0 commit comments

Comments
 (0)