1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix unbound function in swaps controller (#9496)

The `_fetchAndSetSwapsLiveness` was accidentally passed to
`setInterval` without being bound first, so the `this` reference was
not defined when it was called. It is now bound before being passed to
`setInterval`.
This commit is contained in:
Mark Stacey 2020-10-07 00:03:59 -03:00 committed by GitHub
parent 1ba4061f46
commit e8774f615d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -515,7 +515,7 @@ export default class SwapsController {
if (window.navigator.onLine && intervalId === null) {
// Set the interval first to prevent race condition between listener and
// initial call to this function.
intervalId = setInterval(this._fetchAndSetSwapsLiveness, TEN_MINUTES_MS)
intervalId = setInterval(this._fetchAndSetSwapsLiveness.bind(this), TEN_MINUTES_MS)
this._fetchAndSetSwapsLiveness()
}
}