Skip to content

Commit 34b79e5

Browse files
authored
[:coffin:] Refactoring return values (#1209)
# ✍️ Description While doing #1204 a bit of refactoring is needed; and I realized this return value is never used. Giving it its own PR since it's a change in API, and want it to be tested with the rest. Also, some refactoring mainly eliminating `await` and `return` where they're not actually needed. ### 🏗️ Fixes PROD4PROD-1931 It contributes to cleaning the repository, and improve test coverage in `importer`; eliminating code that's not used will no doubt contribute to that.
1 parent f956422 commit 34b79e5

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

feature-utils/poly-import/src/storage.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export class FeatureFileStorage {
1717
statResults[file.id] = await polyOut.stat(file.id);
1818
}
1919
this._files = statResults;
20-
return files;
2120
}
2221

2322
async readFile(path) {

feature-utils/poly-look/src/react-components/contexts/poly-import.jsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,11 @@ export const PolyImportProvider = ({
3232
storage
3333
.refreshFiles()
3434
.then(async () => {
35-
const resolvedFiles = [];
3635
if (!storage.files) {
3736
setFiles(null);
3837
return;
3938
}
40-
for (const file of storage.files) {
41-
resolvedFiles.push(await file);
42-
}
39+
const resolvedFiles = await Promise.all(storage.files);
4340
setFiles(resolvedFiles);
4441
setIsLoading(false);
4542
})
@@ -54,11 +51,8 @@ export const PolyImportProvider = ({
5451
useEffect(() => {
5552
if (!pod) return;
5653
const storage = new FeatureFileStorage(pod, async () => {
57-
const resolvedFiles = [];
58-
for (const file of storage.files) {
59-
resolvedFiles.push(await file);
60-
}
61-
setFiles(Object.values(resolvedFiles));
54+
const resolvedFiles = await Promise.all(storage.files);
55+
setFiles(resolvedFiles);
6256
});
6357
setStorage(storage);
6458
}, [pod]);

0 commit comments

Comments
 (0)