Skip to content

Commit

Permalink
v12.12.6: fix: prevents infinite loading deadlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Sep 5, 2024
1 parent 145f0c4 commit c37a41a
Show file tree
Hide file tree
Showing 18 changed files with 96 additions and 253 deletions.
2 changes: 1 addition & 1 deletion dist/esm/index.bundle.js

Large diffs are not rendered by default.

50 changes: 13 additions & 37 deletions dist/esm/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -25711,7 +25711,7 @@ var PaymentRoutingProvider = (function (props) {

var getPaymentRoutes = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
var updatable, slowRoutingTimeout, firstRouteDisplayed;
var updatable, slowRoutingTimeout;
return regenerator.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
Expand All @@ -25728,38 +25728,11 @@ var PaymentRoutingProvider = (function (props) {
case 3:
slowRoutingTimeout = setTimeout(function () {
setSlowRouting(true);
}, 4000);
}, 3000);
_context.next = 6;
return routePayments(Object.assign({}, configuration, {
accept: props.accept,
account: account,
drip: function drip(route) {
if (amountsMissing) {
return;
}

if (route.fromToken.address !== route.toToken.address && !Blockchains[route.blockchain].tokens.find(function (token) {
return token.address.toLowerCase() === route.fromToken.address.toLowerCase();
})) {
return;
}

if (allRoutesLoaded) {
return;
}

if (route.approvalRequired) {
return;
}

if (firstRouteDisplayed) {
return;
}

firstRouteDisplayed = true;
clearInterval(slowRoutingTimeout);
setUpdatedRoutes([route]);
}
account: account
})).then(function (routes) {
setUpdatedRoutes(routes);
setAllRoutesLoadedInternal(true);
Expand Down Expand Up @@ -25882,17 +25855,20 @@ var PaymentRoutingProvider = (function (props) {

useEffect(function () {
var timeout = setTimeout(function () {
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
if (allRoutesLoaded) {
// do not reload if first routes have not been loaded yet
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
}
}, 15000);
return function () {
return clearTimeout(timeout);
};
}, [reloadCount, allRoutes, selectedRoute, updatable]);
}, [reloadCount, allRoutes, allRoutesLoaded, selectedRoute, updatable]);
useEffect(function () {
if (recover) {
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.evm.js.map

Large diffs are not rendered by default.

50 changes: 13 additions & 37 deletions dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25674,7 +25674,7 @@ var PaymentRoutingProvider = (function (props) {

var getPaymentRoutes = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
var updatable, slowRoutingTimeout, firstRouteDisplayed;
var updatable, slowRoutingTimeout;
return regenerator.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
Expand All @@ -25691,38 +25691,11 @@ var PaymentRoutingProvider = (function (props) {
case 3:
slowRoutingTimeout = setTimeout(function () {
setSlowRouting(true);
}, 4000);
}, 3000);
_context.next = 6;
return routePayments(Object.assign({}, configuration, {
accept: props.accept,
account: account,
drip: function drip(route) {
if (amountsMissing) {
return;
}

if (route.fromToken.address !== route.toToken.address && !Blockchains[route.blockchain].tokens.find(function (token) {
return token.address.toLowerCase() === route.fromToken.address.toLowerCase();
})) {
return;
}

if (allRoutesLoaded) {
return;
}

if (route.approvalRequired) {
return;
}

if (firstRouteDisplayed) {
return;
}

firstRouteDisplayed = true;
clearInterval(slowRoutingTimeout);
setUpdatedRoutes([route]);
}
account: account
})).then(function (routes) {
setUpdatedRoutes(routes);
setAllRoutesLoadedInternal(true);
Expand Down Expand Up @@ -25845,17 +25818,20 @@ var PaymentRoutingProvider = (function (props) {

useEffect(function () {
var timeout = setTimeout(function () {
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
if (allRoutesLoaded) {
// do not reload if first routes have not been loaded yet
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
}
}, 15000);
return function () {
return clearTimeout(timeout);
};
}, [reloadCount, allRoutes, selectedRoute, updatable]);
}, [reloadCount, allRoutes, allRoutesLoaded, selectedRoute, updatable]);
useEffect(function () {
if (recover) {
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.js.map

Large diffs are not rendered by default.

50 changes: 13 additions & 37 deletions dist/esm/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -25712,7 +25712,7 @@ var PaymentRoutingProvider = (function (props) {

var getPaymentRoutes = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
var updatable, slowRoutingTimeout, firstRouteDisplayed;
var updatable, slowRoutingTimeout;
return regenerator.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
Expand All @@ -25729,38 +25729,11 @@ var PaymentRoutingProvider = (function (props) {
case 3:
slowRoutingTimeout = setTimeout(function () {
setSlowRouting(true);
}, 4000);
}, 3000);
_context.next = 6;
return routePayments(Object.assign({}, configuration, {
accept: props.accept,
account: account,
drip: function drip(route) {
if (amountsMissing) {
return;
}

if (route.fromToken.address !== route.toToken.address && !Blockchains[route.blockchain].tokens.find(function (token) {
return token.address.toLowerCase() === route.fromToken.address.toLowerCase();
})) {
return;
}

if (allRoutesLoaded) {
return;
}

if (route.approvalRequired) {
return;
}

if (firstRouteDisplayed) {
return;
}

firstRouteDisplayed = true;
clearInterval(slowRoutingTimeout);
setUpdatedRoutes([route]);
}
account: account
})).then(function (routes) {
setUpdatedRoutes(routes);
setAllRoutesLoadedInternal(true);
Expand Down Expand Up @@ -25883,17 +25856,20 @@ var PaymentRoutingProvider = (function (props) {

useEffect(function () {
var timeout = setTimeout(function () {
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
if (allRoutesLoaded) {
// do not reload if first routes have not been loaded yet
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
}
}, 15000);
return function () {
return clearTimeout(timeout);
};
}, [reloadCount, allRoutes, selectedRoute, updatable]);
}, [reloadCount, allRoutes, allRoutesLoaded, selectedRoute, updatable]);
useEffect(function () {
if (recover) {
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.solana.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/umd/index.bundle.js

Large diffs are not rendered by default.

50 changes: 13 additions & 37 deletions dist/umd/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -25709,7 +25709,7 @@

var getPaymentRoutes = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
var updatable, slowRoutingTimeout, firstRouteDisplayed;
var updatable, slowRoutingTimeout;
return regenerator.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
Expand All @@ -25726,38 +25726,11 @@
case 3:
slowRoutingTimeout = setTimeout(function () {
setSlowRouting(true);
}, 4000);
}, 3000);
_context.next = 6;
return routePayments(Object.assign({}, configuration, {
accept: props.accept,
account: account,
drip: function drip(route) {
if (amountsMissing) {
return;
}

if (route.fromToken.address !== route.toToken.address && !Blockchains__default['default'][route.blockchain].tokens.find(function (token) {
return token.address.toLowerCase() === route.fromToken.address.toLowerCase();
})) {
return;
}

if (allRoutesLoaded) {
return;
}

if (route.approvalRequired) {
return;
}

if (firstRouteDisplayed) {
return;
}

firstRouteDisplayed = true;
clearInterval(slowRoutingTimeout);
setUpdatedRoutes([route]);
}
account: account
})).then(function (routes) {
setUpdatedRoutes(routes);
setAllRoutesLoadedInternal(true);
Expand Down Expand Up @@ -25880,17 +25853,20 @@

React.useEffect(function () {
var timeout = setTimeout(function () {
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
if (allRoutesLoaded) {
// do not reload if first routes have not been loaded yet
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
}
}, 15000);
return function () {
return clearTimeout(timeout);
};
}, [reloadCount, allRoutes, selectedRoute, updatable]);
}, [reloadCount, allRoutes, allRoutesLoaded, selectedRoute, updatable]);
React.useEffect(function () {
if (recover) {
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.evm.js.map

Large diffs are not rendered by default.

50 changes: 13 additions & 37 deletions dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25670,7 +25670,7 @@

var getPaymentRoutes = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
var updatable, slowRoutingTimeout, firstRouteDisplayed;
var updatable, slowRoutingTimeout;
return regenerator.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
Expand All @@ -25687,38 +25687,11 @@
case 3:
slowRoutingTimeout = setTimeout(function () {
setSlowRouting(true);
}, 4000);
}, 3000);
_context.next = 6;
return routePayments(Object.assign({}, configuration, {
accept: props.accept,
account: account,
drip: function drip(route) {
if (amountsMissing) {
return;
}

if (route.fromToken.address !== route.toToken.address && !Blockchains__default['default'][route.blockchain].tokens.find(function (token) {
return token.address.toLowerCase() === route.fromToken.address.toLowerCase();
})) {
return;
}

if (allRoutesLoaded) {
return;
}

if (route.approvalRequired) {
return;
}

if (firstRouteDisplayed) {
return;
}

firstRouteDisplayed = true;
clearInterval(slowRoutingTimeout);
setUpdatedRoutes([route]);
}
account: account
})).then(function (routes) {
setUpdatedRoutes(routes);
setAllRoutesLoadedInternal(true);
Expand Down Expand Up @@ -25841,17 +25814,20 @@

React.useEffect(function () {
var timeout = setTimeout(function () {
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
if (allRoutesLoaded) {
// do not reload if first routes have not been loaded yet
setReloadCount(reloadCount + 1);
getPaymentRoutes({
allRoutes: allRoutes,
selectedRoute: selectedRoute,
updatable: updatable
});
}
}, 15000);
return function () {
return clearTimeout(timeout);
};
}, [reloadCount, allRoutes, selectedRoute, updatable]);
}, [reloadCount, allRoutes, allRoutesLoaded, selectedRoute, updatable]);
React.useEffect(function () {
if (recover) {
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit c37a41a

Please sign in to comment.