Skip to content

Commit

Permalink
[ONL-6386] Removing finally block in EcWithAbortableFetch (#1079)
Browse files Browse the repository at this point in the history
* [ONL-6386] Removing finally block in EcWithAbortableFetch

* 1.9.7

Co-authored-by: Jose Calvente <[email protected]>
  • Loading branch information
jafcalvente and Jose Calvente authored Mar 3, 2022
1 parent 5273603 commit acd732f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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/)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ exports[`EcWithAbortableFetch should stop fetching and keep the state intact if
Object {
"data": null,
"error": null,
"loading": false,
"loading": true,
}
`;

Expand Down
7 changes: 4 additions & 3 deletions src/hocs/ec-with-abortable-fetch/ec-with-abortable-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
},
},
Expand Down

1 comment on commit acd732f

@vercel
Copy link

@vercel vercel bot commented on acd732f Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.