diff --git a/package-lock.json b/package-lock.json index 722c78777..7730243d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ebury/chameleon-components", - "version": "1.9.6", + "version": "1.9.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@ebury/chameleon-components", - "version": "1.9.6", + "version": "1.9.7", "license": "MIT", "dependencies": { "clipboard-copy": "3.2.0", diff --git a/package.json b/package.json index fb4c847ea..2e5764c22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ebury/chameleon-components", - "version": "1.9.6", + "version": "1.9.7", "main": "src/main.js", "sideEffects": false, "author": "Ebury Team (http://labs.ebury.rocks/)", diff --git a/src/hocs/ec-with-abortable-fetch/__snapshots__/ec-with-abortable-fetch.spec.js.snap b/src/hocs/ec-with-abortable-fetch/__snapshots__/ec-with-abortable-fetch.spec.js.snap index 364e7067d..ac85e7fd3 100644 --- a/src/hocs/ec-with-abortable-fetch/__snapshots__/ec-with-abortable-fetch.spec.js.snap +++ b/src/hocs/ec-with-abortable-fetch/__snapshots__/ec-with-abortable-fetch.spec.js.snap @@ -254,7 +254,7 @@ exports[`EcWithAbortableFetch should stop fetching and keep the state intact if Object { "data": null, "error": null, - "loading": false, + "loading": true, } `; diff --git a/src/hocs/ec-with-abortable-fetch/ec-with-abortable-fetch.js b/src/hocs/ec-with-abortable-fetch/ec-with-abortable-fetch.js index 43fd7b863..d1ca55e24 100644 --- a/src/hocs/ec-with-abortable-fetch/ec-with-abortable-fetch.js +++ b/src/hocs/ec-with-abortable-fetch/ec-with-abortable-fetch.js @@ -56,14 +56,15 @@ const withAbortableFetch = (Component, { this.fetchAbortController = new global.AbortController(); try { this.fetchedData = await this.dataSource.fetch(fetchArgs, this.fetchAbortController.signal); + this.isFetching = false; + this.fetchAbortController = null; } catch (err) { if (err && err.name !== 'AbortError') { this.$emit('error', err); this.fetchError = err; + this.isFetching = false; + this.fetchAbortController = null; } - } finally { - this.fetchAbortController = null; - this.isFetching = false; } }, },