mirror of
https://github.com/gosticks/web.git
synced 2026-10-06 22:57:01 +00:00
Prevent WithAPIData promises from getting orphaned when refreshing
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
@@ -64,6 +64,11 @@ export class WithAPIData extends Component {
|
||||
interval: this.props.repeatOptions.interval
|
||||
};
|
||||
|
||||
// Clear in-flight or repeating requests so they are not orphaned
|
||||
if (this.dataHandle) {
|
||||
this.dataHandle.cancel();
|
||||
}
|
||||
|
||||
this.dataHandle = makeCancelable(this.props.apiCall(), cancelOptions);
|
||||
|
||||
this.dataHandle.promise
|
||||
|
||||
Reference in New Issue
Block a user