mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 10:57:35 -02:30
useWsInventories cleanup
This commit is contained in:
@@ -34,17 +34,13 @@ export default function useWsProjects(
|
|||||||
const newInventories = await fetchInventoriesById(
|
const newInventories = await fetchInventoriesById(
|
||||||
throttledInventoriesToFetch
|
throttledInventoriesToFetch
|
||||||
);
|
);
|
||||||
let updated = inventories;
|
const updated = [...inventories];
|
||||||
newInventories.forEach(inventory => {
|
newInventories.forEach(inventory => {
|
||||||
const index = inventories.findIndex(i => i.id === inventory.id);
|
const index = inventories.findIndex(i => i.id === inventory.id);
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updated = [
|
updated[index] = inventory;
|
||||||
...updated.slice(0, index),
|
|
||||||
inventory,
|
|
||||||
...updated.slice(index + 1),
|
|
||||||
];
|
|
||||||
});
|
});
|
||||||
setInventories(updated);
|
setInventories(updated);
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user