mirror of
https://github.com/ansible/awx.git
synced 2024-10-30 22:21:13 +03:00
useWsInventories cleanup
This commit is contained in:
parent
f225df1acd
commit
38e0968690
@ -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);
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user