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