Skip to content

Commit 3eabf52

Browse files
committed
Fix breakages
1 parent ddb32ea commit 3eabf52

File tree

25 files changed

+89
-54
lines changed

25 files changed

+89
-54
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/permission-page-container/permission-page-container.component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default class PermissionPageContainer extends Component {
134134

135135
onCancel = () => {
136136
const { request, rejectPermissionsRequest } = this.props;
137-
rejectPermissionsRequest(request.metadata.id);
137+
rejectPermissionsRequest(request?.metadata?.id);
138138
};
139139

140140
onSubmit = () => {
@@ -169,7 +169,7 @@ export default class PermissionPageContainer extends Component {
169169
if (Object.keys(request.permissions).length > 0) {
170170
approvePermissionsRequest(request);
171171
} else {
172-
rejectPermissionsRequest(request.metadata.id);
172+
rejectPermissionsRequest(request?.metadata?.id);
173173
}
174174
};
175175

ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ const SnapUIRendererComponent = ({
4545
contentBackgroundColor,
4646
PERF_DEBUG,
4747
}) => {
48+
// eslint-disable-next-line react-compiler/react-compiler
49+
'use no memo';
50+
4851
const t = useI18nContext();
4952

5053
const interfaceState = useSelector(

ui/components/ui/metafox-logo/metafox-logo.component.test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import React from 'react';
22
import { renderWithProvider } from '../../../../test/lib/render-helpers';
33
import MetaFoxLogo from '.';
44

5-
// eslint-disable-next-line react/display-name
6-
jest.mock('./horizontal-logo.js', () => () => {
7-
return <div></div>;
8-
});
5+
jest.mock(
6+
'./horizontal-logo.js',
7+
() =>
8+
function mockRender() {
9+
return <div></div>;
10+
},
11+
);
912

1013
describe('MetaFoxLogo', () => {
1114
it('should match snapshot with img width and height default set to 42', () => {

ui/ducks/confirm-alerts/confirm-alerts.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export type ConfirmAlertsState = {
116116

117117
type UpdateAlertsAction = {
118118
type: 'UPDATE_ALERTS';
119-
ownerId: string;
119+
ownerId: string | undefined;
120120
alerts: Alert[];
121121
};
122122

@@ -129,7 +129,7 @@ type SetAlertConfirmedAction = {
129129

130130
type ClearAlertsAction = {
131131
type: 'CLEAR_ALERTS';
132-
ownerId: string;
132+
ownerId: string | undefined;
133133
};
134134

135135
type Action = UpdateAlertsAction | SetAlertConfirmedAction | ClearAlertsAction;
@@ -150,7 +150,7 @@ export default function confirmAlertsReducer(
150150
...state,
151151
alerts: {
152152
...state.alerts,
153-
[action.ownerId]: action.alerts,
153+
[action.ownerId ?? '']: action.alerts,
154154
},
155155
};
156156

@@ -171,11 +171,11 @@ export default function confirmAlertsReducer(
171171
...state,
172172
alerts: {
173173
...state.alerts,
174-
[action.ownerId]: [],
174+
[action.ownerId ?? '']: [],
175175
},
176176
confirmed: {
177177
...state.confirmed,
178-
[action.ownerId]: {},
178+
[action.ownerId ?? '']: {},
179179
},
180180
};
181181

@@ -185,7 +185,7 @@ export default function confirmAlertsReducer(
185185
}
186186

187187
export function updateAlerts(
188-
ownerId: string,
188+
ownerId: string | undefined,
189189
alerts: Alert[],
190190
): UpdateAlertsAction {
191191
return {
@@ -208,7 +208,7 @@ export function setAlertConfirmed(
208208
};
209209
}
210210

211-
export function clearAlerts(ownerId: string): ClearAlertsAction {
211+
export function clearAlerts(ownerId: string | undefined): ClearAlertsAction {
212212
return {
213213
type: 'CLEAR_ALERTS',
214214
ownerId,

ui/helpers/utils/notification.util.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,9 @@ export function hasNetworkFeeFields(
410410
return 'network_fee' in notification.data;
411411
}
412412

413-
export const getNetworkFees = async (notification: OnChainRawNotification) => {
413+
export const getNetworkFees = async (
414+
notification: OnChainRawNotificationsWithNetworkFields,
415+
) => {
414416
if (!hasNetworkFeeFields(notification)) {
415417
throw new Error('Invalid notification type');
416418
}

ui/hooks/useScrollRequired.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, useState } from 'react';
1+
import { useCallback, useEffect, useRef, useState } from 'react';
22
import { debounce } from 'lodash';
33
import { usePrevious } from './usePrevious';
44

@@ -24,7 +24,7 @@ export const useScrollRequired = (
2424
const [isScrollableState, setIsScrollable] = useState(false);
2525
const [isScrolledToBottomState, setIsScrolledToBottom] = useState(false);
2626

27-
const update = () => {
27+
const update = useCallback(() => {
2828
if (!ref.current) {
2929
return;
3030
}
@@ -51,15 +51,15 @@ export const useScrollRequired = (
5151
if (!isScrollable || isScrolledToBottom) {
5252
setHasScrolledToBottom(true);
5353
}
54-
};
54+
}, [isScrollableState, offsetPxFromBottom]);
5555

5656
useEffect(update, [ref, ...dependencies]);
5757

5858
useEffect(() => {
5959
if (prevOffsetHeight !== ref.current?.offsetHeight) {
6060
update();
6161
}
62-
}, [ref.current?.offsetHeight]);
62+
}, [update, ref.current?.offsetHeight, prevOffsetHeight]);
6363

6464
const scrollToBottom = () => {
6565
setIsScrolledToBottom(true);

ui/hooks/useTrustSignals.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
'use no memo';
2+
// TODO: Fix - Calling `useTrustSignals` from `useTrustSignal`, which is not a component, violates the rules of hooks.
3+
14
import { useSelector } from 'react-redux';
25
import { NameType } from '@metamask/name-controller';
36
import { getAddressSecurityAlertResponse } from '../selectors';

ui/pages/confirmations/components/confirm/info/shared/transaction-details/transaction-details.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const OriginRow = () => {
4646
return (
4747
<ConfirmInfoAlertRow
4848
alertKey={RowAlertKey.RequestFrom}
49-
ownerId={currentConfirmation.id}
49+
ownerId={currentConfirmation?.id}
5050
data-testid="transaction-details-origin-row"
5151
label={t('requestFrom')}
5252
tooltip={t('requestFromTransactionDescription')}

0 commit comments

Comments
 (0)