Skip to content

Commit ec7f882

Browse files
skoloCFDfinetjul
authored andcommitted
fix(i/o): chain loadData promise in 3 readers instead of branching prevents unhandled rejection
#3437
1 parent 2d4d284 commit ec7f882

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

Sources/IO/Geometry/PLYReader/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -627,11 +627,8 @@ function vtkPLYReader(publicAPI, model) {
627627
};
628628

629629
// Fetch the actual data arrays
630-
publicAPI.loadData = (option = {}) => {
631-
const promise = fetchData(model.url, option);
632-
promise.then(publicAPI.parse);
633-
return promise;
634-
};
630+
publicAPI.loadData = (option = {}) =>
631+
fetchData(model.url, option).then(publicAPI.parse);
635632

636633
publicAPI.parse = (content) => {
637634
if (typeof content === 'string') {

Sources/IO/Geometry/STLReader/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,8 @@ function vtkSTLReader(publicAPI, model) {
240240
};
241241

242242
// Fetch the actual data arrays
243-
publicAPI.loadData = (option = {}) => {
244-
const promise = fetchData(model.url, option);
245-
promise.then(publicAPI.parse);
246-
return promise;
247-
};
243+
publicAPI.loadData = (option = {}) =>
244+
fetchData(model.url, option).then(publicAPI.parse);
248245

249246
publicAPI.parse = (content) => {
250247
if (typeof content === 'string') {

Sources/IO/Legacy/PolyDataReader/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ function vtkPolyDataReader(publicAPI, model) {
4646
};
4747

4848
// Fetch the actual data arrays
49-
publicAPI.loadData = (option = {}) => {
50-
const promise = fetchData(model.url, option);
51-
promise.then(publicAPI.parseAsText);
52-
return promise;
53-
};
49+
publicAPI.loadData = (option = {}) =>
50+
fetchData(model.url, option).then(publicAPI.parseAsText);
5451

5552
publicAPI.parseAsText = (content) => {
5653
if (!content) {

0 commit comments

Comments
 (0)