From 600804601acb5f883f89f87725a5958021d85b12 Mon Sep 17 00:00:00 2001 From: nuanyang233 <528944303@qq.com> Date: Fri, 17 Dec 2021 19:25:47 +0800 Subject: [PATCH] fix: reset page tag when identifier be changed --- .../src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx b/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx index 1e4ccbb9de06..9e96f2171a51 100644 --- a/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx +++ b/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, useMemo } from 'react' +import { useEffect, useMemo, useState } from 'react' import { makeStyles, useStylesExtends } from '@masknet/theme' import { MaskMessages } from '../../../utils' @@ -12,6 +12,7 @@ import { PageTags } from '../types' import { unreachable } from '@dimensiondev/kit' import { PageTag } from './PageTag' import { useDao } from './hooks/useDao' +import { useUpdateEffect } from 'react-use' const useStyles = makeStyles()((theme) => ({ root: { @@ -61,7 +62,11 @@ export function EnhancedProfilePage(props: EnhancedProfilePageProps) { default: unreachable(currentTag) } - }, [currentTag]) + }, [currentTag, daoPayload, identity.identifier]) + + useUpdateEffect(() => { + setCurrentTag(PageTags.NFTTag) + }, [identity.identifier]) if (!show) return null