Skip to content

Commit

Permalink
[Human App] fix: error notification is displayed twice when should be…
Browse files Browse the repository at this point in the history
… once (#3110)
  • Loading branch information
mpblocky authored Feb 21, 2025
1 parent f9a2c4d commit 060c601
Showing 1 changed file with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,34 @@ import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-use
export function WorkerProfilePage() {
const { user } = useAuthenticatedUser();
const isMobile = useIsMobile();
const { isConnected } = useWalletConnect();
const { isConnected, initializing, web3ProviderMutation } =
useWalletConnect();
const { showNotification } = useNotification();

const setNotifications = () => {
if (user.wallet_address) {
return;
useEffect(() => {
if (initializing) return;

if (!isConnected || !user.wallet_address) {
showNotification({
type: TopNotificationType.WARNING,
message: t('worker.profile.topNotifications.completeSteps'),
});
}
showNotification({
type: TopNotificationType.WARNING,
message: t('worker.profile.topNotifications.completeSteps'),
});
};

useEffect(() => {
setNotifications();
// eslint-disable-next-line react-hooks/exhaustive-deps -- call this once
}, [isConnected]);
if (web3ProviderMutation.isError && web3ProviderMutation.failureReason) {
showNotification({
type: TopNotificationType.WARNING,
message: web3ProviderMutation.failureReason.message,
});
}
}, [
isConnected,
initializing,
web3ProviderMutation.failureReason,
web3ProviderMutation.isError,
user.wallet_address,
showNotification,
]);

return (
<Paper
Expand Down

0 comments on commit 060c601

Please sign in to comment.