Skip to content

Commit

Permalink
fix some issues hydration crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Dec 9, 2024
1 parent 5d723e2 commit 4254f62
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 26 deletions.
9 changes: 4 additions & 5 deletions src/components/ConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const HeaderProfile = ({ address }: { address: Address }) => {
),
as: 'a' as 'a',
color: 'text',
icon: <PersonSVG />,
icon: PersonSVG,
},
]
: []),
Expand All @@ -166,29 +166,28 @@ const HeaderProfile = ({ address }: { address: Address }) => {
</BaseLink>
),
as: 'a',
icon: <CogSVG />,
icon: CogSVG,
showIndicator: hasPendingTransactions,
},
<SectionDivider key="divider" />,
{
label: shortenAddress(address),
color: 'text',
onClick: () => copy(address),
icon: copied ? <CheckSVG /> : <CopySVG />,
icon: copied ? CheckSVG : CopySVG,
},
{
label: t('wallet.disconnect'),
color: 'red',
onClick: () => disconnect(),
icon: <ExitSVG />,
icon: ExitSVG,
},
] as DropdownItem[]
}
avatar={{
src: avatar || zorb,
decoding: 'sync',
loading: 'eager',
noBorder: true,
overlay: avatar ? undefined : (
<PersonOverlay>
<PersonSVG />
Expand Down
20 changes: 10 additions & 10 deletions src/components/pages/profile/ProfileButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ export const AddressProfileButton = ({
const items = [
iconKey === 'eth'
? {
icon: <UpRightArrowSVG />,
icon: UpRightArrowSVG,
label: 'View address',
href: getDestination(`/${address}`) as string,
}
: undefined,
{
icon: <CopySVG />,
icon: CopySVG,
label: 'Copy address',
onClick: () => copy(address),
},
defaultBlockExplorer
? {
icon: <UpRightArrowSVG />,
icon: UpRightArrowSVG,
label: `View on ${defaultBlockExplorer?.name}`,
href: `${defaultBlockExplorer?.url}/address/${address}`,
}
Expand All @@ -128,7 +128,7 @@ export const AddressProfileButton = ({
<RecordItem
data-testid={`address-profile-button-${iconKey}`}
postfixIcon={VerticalDotsSVG}
icon={<StyledAddressIcon name={iconKey} />}
icon={() => <StyledAddressIcon name={iconKey} />}
value={address}
size={breakpoints.sm ? 'large' : 'small'}
inline
Expand Down Expand Up @@ -324,32 +324,32 @@ export const OwnerProfileButton = ({
const items = [
link
? {
icon: <UpRightArrowSVG />,
icon: UpRightArrowSVG,
label: 'View profile',
href: link,
}
: undefined,
primary.data?.name
? {
icon: <CopySVG />,
icon: CopySVG,
label: 'Copy name',
onClick: () => copy(primary.data?.name!),
}
: undefined,
...(dataType === 'address'
? ([
{
icon: <UpRightArrowSVG />,
icon: UpRightArrowSVG,
label: 'View address',
href: getDestination(`/${addressOrNameOrDate}`) as string,
},
{
icon: <CopySVG />,
icon: CopySVG,
label: 'Copy address',
onClick: () => copy(addressOrNameOrDate),
},
{
icon: <UpRightArrowSVG />,
icon: UpRightArrowSVG,
label: 'View on Etherscan',
href: makeEtherscanLink(addressOrNameOrDate, 'mainnet', 'address'),
},
Expand Down Expand Up @@ -407,7 +407,7 @@ export const VerificationProfileButton = ({
tooltipContent={<VerificationBadgeVerifierTooltipContent isVerified={!!isVerified} />}
>
<RecordItem
icon={<DynamicVerificationIcon name={iconKey} />}
icon={() => <DynamicVerificationIcon name={iconKey} />}
size={breakpoints.sm ? 'large' : 'small'}
inline
data-testid={`verification-profile-button-${iconKey}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,27 @@ export const RoleRow = ({ name, address, roles, actions, isWrapped, isEmancipate
label: t('wallet.viewProfile'),
onClick: () => router.push(getDestination(`/profile/${primary.data!.name}`) as string),
color: 'text',
icon: <UpRightArrowSVG />,
icon: UpRightArrowSVG,
},
{
label: t('name.copy'),
onClick: () => copy(primary.data!.name!),
color: 'text',
icon: <CopySVG />,
icon: CopySVG,
},
] as DropdownItem[])
: []),
{
label: t('address.viewAddress'),
onClick: () => router.push(getDestination(`/address/${address}`) as string),
color: 'text',
icon: <UpRightArrowSVG />,
icon: UpRightArrowSVG,
},
{
label: t('address.copyAddress'),
onClick: () => copy(address!),
color: 'text',
icon: <CopySVG />,
icon: CopySVG,
},
...(etherscanAction ? [etherscanAction] : []),
...(editRolesAction ? [editRolesAction] : []),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const useRoleActions = ({ name, roles, details }: Props) => {
showSendDNS
? {
type: 'send-dns',
icon: <AeroplaneSVG />,
icon: AeroplaneSVG,
label: t('action.send'),
error: canSendError,
onClick: () => showSendNameInput(`send-name-${name}`, { name }),
Expand All @@ -81,7 +81,7 @@ export const useRoleActions = ({ name, roles, details }: Props) => {
canRefreshDNS
? {
type: 'refresh-dns',
icon: <CounterClockwiseArrowSVG />,
icon: CounterClockwiseArrowSVG,
label: t('dns.refresh'),
onClick: () =>
queryClient.resetQueries({ exact: true, queryKey: ['getDNSOwner', name] }),
Expand All @@ -90,7 +90,7 @@ export const useRoleActions = ({ name, roles, details }: Props) => {
showSyncManager
? {
type: 'sync-manager',
icon: <HorizontalOutwardArrowsSVG />,
icon: HorizontalOutwardArrowsSVG,
label: t('transaction.description.syncManager'),
onClick: () =>
showSyncManagerInput(`sync-manager-${name}`, {
Expand All @@ -101,7 +101,7 @@ export const useRoleActions = ({ name, roles, details }: Props) => {
showSendEth
? {
type: 'send-name',
icon: <AeroplaneSVG />,
icon: AeroplaneSVG,
label: t('action.send'),
error: canSendError,
onClick: () => showSendNameInput(`send-name-${name}`, { name }),
Expand All @@ -110,7 +110,7 @@ export const useRoleActions = ({ name, roles, details }: Props) => {
canEditRoles
? {
type: 'edit-roles',
icon: <PersonSVG />,
icon: PersonSVG,
label: t('action.editRoles'),
primary: true,
onClick: () => showEditRolesInput(`edit-roles-${name}`, { name }),
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/profile/[name]/tabs/SubnamesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const SubnamesTab = ({
<Button
data-testid="add-subname-action"
onClick={createSubname}
prefix={<PlusPrefix as={PlusSVG} />}
prefix={() => <PlusPrefix as={PlusSVG} />}
>
{t('details.tabs.subnames.addSubname.action')}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const ProfileBlurb = ({ name, resolverAddress }: Props) => {
return (
<Container>
<AvatarWrapper>
<Avatar label="profile-button-avatar" src={avatar || zorb} noBorder />
<Avatar label="profile-button-avatar" src={avatar || zorb} />
</AvatarWrapper>
<InfoContainer>
<Typography fontVariant="extraLargeBold">{name}</Typography>
Expand Down

0 comments on commit 4254f62

Please sign in to comment.