Skip to content

Commit

Permalink
Merge pull request input-output-hk#1378 from input-output-hk/ensemble…
Browse files Browse the repository at this point in the history
…/fix-explorer-switch-aggregator

Fix explorer switch aggregator infinite loop
  • Loading branch information
jpraynaud authored Nov 30, 2023
2 parents a659cc7 + 8343f6f commit 426b764
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mithril-explorer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mithril-explorer",
"version": "0.4.5",
"version": "0.4.6",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
17 changes: 10 additions & 7 deletions mithril-explorer/src/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,21 @@ export default function Explorer() {
}

dispatch(updatePoolsForAggregator(selectedAggregator));
}, [selectedAggregator, router, searchParams, dispatch]);
}, [selectedAggregator]); // eslint-disable-line react-hooks/exhaustive-deps

// Allow navigation to work (previous, next)
useEffect(() => {
if (isUpdatingAggregatorInUrl) {
setIsUpdatingAggregatorInUrl(false);
} else {
const aggregatorInUrl = searchParams.get("aggregator");
function allowNavigation() {
if (isUpdatingAggregatorInUrl) {
setIsUpdatingAggregatorInUrl(false);
} else {
const aggregatorInUrl = searchParams.get("aggregator");

dispatch(selectAggregator(aggregatorInUrl));
dispatch(selectAggregator(aggregatorInUrl));
}
}
}, [searchParams, dispatch, isUpdatingAggregatorInUrl]);
allowNavigation();
}, [searchParams]); // eslint-disable-line react-hooks/exhaustive-deps

return (
<Stack gap={3}>
Expand Down
2 changes: 1 addition & 1 deletion mithril-explorer/src/app/registrations/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default function Registrations() {
} else {
setCurrentError(error);
}
}, [searchParams, dispatch]);
}, [searchParams]); // eslint-disable-line react-hooks/exhaustive-deps

function getNoRegistrationsMessage() {
if (currentEpoch === registrationEpoch) {
Expand Down

0 comments on commit 426b764

Please sign in to comment.