Skip to content

Commit

Permalink
fix(launchpad): [GSW-1740] Improve default pool selection in detail p…
Browse files Browse the repository at this point in the history
…age (#545)
  • Loading branch information
tfrg authored Oct 28, 2024
1 parent 935fe2a commit 3201998
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ const LaunchpadDetail: React.FC = () => {
* @dev Refetchs
*/
const refetchProjectDetail = async () => {
await setSelectPoolId(null);
setSelectPoolId(null);
await projectDetailRefetch();
await myParticipationRefetch();
await updateBalances();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const LaunchpadPoolList: React.FC<LaunchpadPoolListProps> = ({
const [, setSelectLaunchpadPool] = useAtom(
LaunchpadState.selectLaunchpadPool,
);
const isInitialMount = React.useRef(true);

const sortedPools = React.useMemo(() => {
return [...pools].sort(
Expand All @@ -45,8 +46,9 @@ const LaunchpadPoolList: React.FC<LaunchpadPoolListProps> = ({
}, [sortedPools, sortedPools.length, setSelectLaunchpadPool]);

React.useEffect(() => {
if (sortedPools && status === "ONGOING") {
if (sortedPools && status === "ONGOING" && isInitialMount.current) {
defaultSelectPool();
isInitialMount.current = false;
}
}, [sortedPools, sortedPools.length, status, defaultSelectPool]);

Expand Down

0 comments on commit 3201998

Please sign in to comment.