Skip to content

Commit 911abc8

Browse files
committed
stash
1 parent 3ce8f71 commit 911abc8

File tree

19 files changed

+93
-65
lines changed

19 files changed

+93
-65
lines changed

ui/components/app/alert-system/general-alert/general-alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function AlertDetails({
8282
return (
8383
<Box marginTop={1}>
8484
<Disclosure title={t('seeDetails')} variant={DisclosureVariant.Arrow}>
85-
{details instanceof Array ? (
85+
{Array.isArray(details) ? (
8686
<Box as="ul" className="alert-modal__alert-details" paddingLeft={6}>
8787
{details.map((detail, index) => (
8888
<Box as="li" key={`disclosure-detail-${index}`}>

ui/components/app/identity/backup-and-sync-features-toggles/backup-and-sync-features-toggles.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ const FeatureToggle = ({
6262
section,
6363
isBackupAndSyncUpdateLoading,
6464
isBackupAndSyncEnabled,
65+
key,
6566
}: {
6667
section: (typeof backupAndSyncFeaturesTogglesSections)[number];
6768
isBackupAndSyncUpdateLoading: boolean;
6869
isBackupAndSyncEnabled: boolean;
70+
key: number;
6971
}) => {
7072
const t = useI18nContext();
7173
const trackEvent = useContext(MetaMetricsContext);
@@ -107,6 +109,7 @@ const FeatureToggle = ({
107109

108110
return (
109111
<Box
112+
key={key}
110113
display={Display.Flex}
111114
justifyContent={JustifyContent.spaceBetween}
112115
alignItems={AlignItems.flexStart}
@@ -169,11 +172,12 @@ export const BackupAndSyncFeaturesToggles = () => {
169172
{t('backupAndSyncManageWhatYouSyncDescription')}
170173
</Text>
171174

172-
{backupAndSyncFeaturesTogglesSections.map((section) =>
175+
{backupAndSyncFeaturesTogglesSections.map((section, index) =>
173176
FeatureToggle({
174177
section,
175178
isBackupAndSyncUpdateLoading,
176179
isBackupAndSyncEnabled,
180+
key: index,
177181
}),
178182
)}
179183
</Box>

ui/components/app/menu-droppo.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export default class MenuDroppoComponent extends Component {
3838

3939
globalClickOccurred = (event) => {
4040
const { target } = event;
41+
42+
// TODO: Remove `findDOMNode`
4143
// eslint-disable-next-line react/no-find-dom-node
4244
const container = findDOMNode(this);
4345

@@ -53,6 +55,8 @@ export default class MenuDroppoComponent extends Component {
5355
componentDidMount() {
5456
if (this && document.body) {
5557
document.body.addEventListener('click', this.globalClickOccurred);
58+
59+
// TODO: Remove `findDOMNode`
5660
// eslint-disable-next-line react/no-find-dom-node
5761
const container = findDOMNode(this);
5862
this.container = container;

ui/components/app/qr-hardware-popover/base-reader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ const BaseReader = ({
128128
clearTimeout(permissionCheckerRef.current);
129129
permissionCheckerRef.current = null;
130130
};
131-
}, []);
131+
}, [checkEnvironment]);
132132

133133
useEffect(() => {
134134
if (ready === READY_STATE.READY) {

ui/components/multichain/asset-picker-amount/asset-picker-modal/hooks/useAssetMetadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const useAssetMetadata = (
6161
const metadata = await fetchAssetMetadata(
6262
trimmedSearchQuery,
6363
chainId,
64-
abortControllerRef.current.signal,
64+
abortControllerRef.current?.signal,
6565
);
6666

6767
if (metadata) {

ui/components/multichain/network-manager/components/default-networks/default-networks.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ const DefaultNetworks = memo(() => {
269269
solAccountGroup,
270270
isMultichainAccountsState2Enabled,
271271
evmAccountGroup,
272+
selectedAccount.scopes,
272273
dispatch,
273274
selectedAccount,
274275
enabledChainIds,

ui/components/ui/disclosure/disclosure.js renamed to ui/components/ui/disclosure/disclosure.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ import { Icon, IconName, IconSize, Text } from '../../component-library';
55
import { Color, TextVariant } from '../../../helpers/constants/design-system';
66
import { DisclosureVariant } from './disclosure.constants';
77

8-
/**
9-
* @param {string} variant
10-
* @param {string} title
11-
* @param {string} size
12-
* @returns {JSX.Element}
13-
*/
14-
const renderSummaryByType = (variant, title, size) => {
8+
const renderSummaryByType = (
9+
variant: DisclosureVariant,
10+
title: string,
11+
size?: string,
12+
) => {
1513
switch (variant) {
1614
case DisclosureVariant.Arrow: {
1715
const textVariant =
1816
size === 'small' ? TextVariant.bodySm : TextVariant.bodyMd;
1917

2018
return (
2119
<summary className="disclosure__summary is-arrow">
20+
{/* @ts-expect-error TODO: update prop type in design systems component */}
2221
<Text color={Color.primaryDefault} variant={textVariant}>
2322
{title}
2423
</Text>
2524
<Icon
2625
className="disclosure__summary--icon"
26+
// @ts-expect-error TODO: update prop types in design systems component
2727
color={Color.primaryDefault}
2828
name={IconName.ArrowUp}
2929
size={IconSize.Sm}
@@ -50,11 +50,17 @@ const renderSummaryByType = (variant, title, size) => {
5050
const Disclosure = ({
5151
children,
5252
isScrollToBottomOnOpen,
53-
title,
54-
size,
55-
variant,
53+
title = null,
54+
size = 'normal',
55+
variant = DisclosureVariant.Default,
56+
}: {
57+
children: JSX.Element[];
58+
isScrollToBottomOnOpen: boolean;
59+
size: string;
60+
title: string | null;
61+
variant: DisclosureVariant;
5662
}) => {
57-
const disclosureFooterEl = useRef(null);
63+
const disclosureFooterEl = useRef<HTMLDivElement | null>(null);
5864
const [open, setOpen] = useState(false);
5965

6066
const scrollToBottom = () => {

ui/ducks/swaps/swaps.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,13 +1505,13 @@ export function cancelSwapsSmartTransaction(uuid) {
15051505
};
15061506
}
15071507

1508-
export const getIsEstimatedReturnLow = ({ usedQuote, rawNetworkFees }) => {
1508+
export const useIsEstimatedReturnLow = ({ usedQuote, rawNetworkFees }) => {
15091509
const sourceTokenAmount = calcTokenAmount(
15101510
usedQuote?.sourceAmount,
15111511
usedQuote?.sourceTokenInfo?.decimals,
15121512
);
15131513
// Disabled because it's not a hook
1514-
// eslint-disable-next-line react-hooks/rules-of-hooks
1514+
15151515
const sourceTokenFiatAmount = useTokenFiatAmount(
15161516
usedQuote?.sourceTokenInfo?.address,
15171517
sourceTokenAmount || 0,
@@ -1528,7 +1528,7 @@ export const getIsEstimatedReturnLow = ({ usedQuote, rawNetworkFees }) => {
15281528
usedQuote?.destinationTokenInfo?.decimals,
15291529
);
15301530
// Disabled because it's not a hook
1531-
// eslint-disable-next-line react-hooks/rules-of-hooks
1531+
15321532
const destinationTokenFiatAmount = useTokenFiatAmount(
15331533
usedQuote?.destinationTokenInfo?.address,
15341534
destinationTokenAmount || 0,

ui/helpers/higher-order-components/with-router-hooks/with-router-hooks.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type RouterHooksProps = {
1515
function withRouterHooks<Props extends object>(
1616
WrappedComponent: React.ComponentType<Props & RouterHooksProps>,
1717
): React.ComponentType<Props> {
18-
const ComponentWithRouterHooks = (props: Props) => {
18+
const useComponentWithRouterHooks = (props: Props) => {
1919
const navigate = useNavigate();
2020
const location = useLocation();
2121
const params = useParams();
@@ -31,11 +31,11 @@ function withRouterHooks<Props extends object>(
3131
};
3232

3333
// Preserve component name for debugging
34-
ComponentWithRouterHooks.displayName = `withRouterHooks(${
34+
useComponentWithRouterHooks.displayName = `withRouterHooks(${
3535
WrappedComponent.displayName || WrappedComponent.name || 'Component'
3636
})`;
3737

38-
return ComponentWithRouterHooks;
38+
return useComponentWithRouterHooks;
3939
}
4040

4141
export default withRouterHooks;

ui/hooks/bridge/useBridging.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const useBridging = () => {
4040
const history = useHistory();
4141
const dispatch = useDispatch();
4242
const trackEvent = useContext(MetaMetricsContext);
43-
4443
const metaMetricsId = useSelector(getMetaMetricsId);
4544
const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics);
4645
const isMarketingEnabled = useSelector(getDataCollectionForMarketing);

0 commit comments

Comments
 (0)