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]);