Skip to content

Commit 3bd8089

Browse files
authored
fix(js): Fix cleanup API client (#12872)
Previously, if there was no callback function (specifically for `complete`), cleanup was skipped entirely.
1 parent 2ae5eee commit 3bd8089

File tree

1 file changed

+6
-6
lines changed
  • src/sentry/static/sentry/app

1 file changed

+6
-6
lines changed

src/sentry/static/sentry/app/api.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,25 @@ export class Client {
8888
}
8989

9090
wrapCallback(id, func, cleanup) {
91-
/*eslint consistent-return:0*/
92-
if (isUndefined(func)) {
93-
return;
94-
}
95-
9691
return (...args) => {
9792
const req = this.activeRequests[id];
9893
if (cleanup === true) {
9994
delete this.activeRequests[id];
10095
}
96+
10197
if (req && req.alive) {
10298
// Check if API response is a 302 -- means project slug was renamed and user
10399
// needs to be redirected
104100
if (this.hasProjectBeenRenamed(...args)) {
105101
return;
106102
}
107103

104+
if (isUndefined(func)) {
105+
return;
106+
}
107+
108108
// Call success callback
109-
return func.apply(req, args);
109+
return func.apply(req, args); // eslint-disable-line
110110
}
111111
};
112112
}

0 commit comments

Comments
 (0)