From e9aeb98f325f1c72d9d162952cd6dd64c1b10f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Juli=C3=A1n=20=28JJ=29=20Merelo?= Date: Mon, 10 Oct 2022 09:18:29 +0200 Subject: [PATCH] :recycle: to make it private --- feature-utils/poly-import/src/storage.js | 6 +++--- .../poly-look/src/react-components/contexts/poly-import.jsx | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/feature-utils/poly-import/src/storage.js b/feature-utils/poly-import/src/storage.js index f222becbe7..07828f2891 100644 --- a/feature-utils/poly-import/src/storage.js +++ b/feature-utils/poly-import/src/storage.js @@ -1,6 +1,6 @@ export class FeatureFileStorage { - constructor(pod) { - this.changeListener = () => {}; + constructor(pod, changeListener = () => {}) { + this._changeListener = changeListener; this._files = null; this._pod = pod; } @@ -29,7 +29,7 @@ export class FeatureFileStorage { const { polyOut } = this._pod; await polyOut.removeArchive(file); await this.refreshFiles(); - this.changeListener(); + this._changeListener(); } } diff --git a/feature-utils/poly-look/src/react-components/contexts/poly-import.jsx b/feature-utils/poly-look/src/react-components/contexts/poly-import.jsx index 0909705e52..eefe86dfe5 100644 --- a/feature-utils/poly-look/src/react-components/contexts/poly-import.jsx +++ b/feature-utils/poly-look/src/react-components/contexts/poly-import.jsx @@ -53,14 +53,13 @@ export const PolyImportProvider = ({ useEffect(() => { if (!pod) return; - const storage = new FeatureFileStorage(pod); - storage.changeListener = async () => { + const storage = new FeatureFileStorage(pod, async () => { const resolvedFiles = []; for (const file of storage.files) { resolvedFiles.push(await file); } setFiles(Object.values(resolvedFiles)); - }; + }); setStorage(storage); }, [pod]);