Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ jest.mock('react-router-dom', () => ({
useParams: () => getMockUseParams(),
}));

type BaseTestComponentProps = {
testProp?: string;
};
type TestComponentProps = RouterHooksProps;

type TestComponentProps = BaseTestComponentProps & RouterHooksProps;

const TestComponent: React.FC<TestComponentProps> = ({
const TestComponent: React.FC<TestComponentProps & { testProp?: string }> = ({
navigate,
location,
params,
Expand Down Expand Up @@ -83,7 +79,7 @@ describe('withRouterHooks HOC', () => {
it('sets correct displayName for debugging', () => {
const testComponentWithDisplayName: React.FC<TestComponentProps> = (
props,
) => <div>{props.testProp}</div>;
) => <div>{props.navigate?.toString()}</div>;
testComponentWithDisplayName.displayName = 'TestComponentWithDisplayName';
const WrappedComponent = withRouterHooks(testComponentWithDisplayName);
expect(WrappedComponent.displayName).toBe(
Expand Down Expand Up @@ -134,24 +130,24 @@ describe('withRouterHooks HOC', () => {
// verifies that useShallowEqualityCheck stabilizes references when values match
const paramsReferences: ReturnType<typeof useParams>[] = [];

const TestComponentForMemo: React.FC<
TestComponentProps & { renderCount?: number }
> = ({ params }) => {
const TestComponentForMemo: React.FC<TestComponentProps> = ({
params,
}) => {
paramsReferences.push(params);
return <div>Memoization test</div>;
};

const WrappedComponent = withRouterHooks(TestComponentForMemo);
const { rerender } = render(
<MemoryRouter>
<WrappedComponent renderCount={1} />
<WrappedComponent />
</MemoryRouter>,
);

// Force re-render with different prop - getMockUseParams() returns new object
rerender(
<MemoryRouter>
<WrappedComponent renderCount={2} />
<WrappedComponent />
</MemoryRouter>,
);

Expand All @@ -164,17 +160,17 @@ describe('withRouterHooks HOC', () => {
// Complementary test: verify memoization correctly detects value changes
const paramsReferences: ReturnType<typeof useParams>[] = [];

const TestComponentForMemo: React.FC<
TestComponentProps & { renderCount?: number }
> = ({ params }) => {
const TestComponentForMemo: React.FC<TestComponentProps> = ({
params,
}) => {
paramsReferences.push(params);
return <div>Memoization test</div>;
};

const WrappedComponent = withRouterHooks(TestComponentForMemo);
const { rerender } = render(
<MemoryRouter>
<WrappedComponent renderCount={1} />
<WrappedComponent />
</MemoryRouter>,
);

Expand All @@ -183,7 +179,7 @@ describe('withRouterHooks HOC', () => {

rerender(
<MemoryRouter>
<WrappedComponent renderCount={2} />
<WrappedComponent />
</MemoryRouter>,
);

Expand All @@ -197,24 +193,24 @@ describe('withRouterHooks HOC', () => {
it('maintains stable location reference when values are unchanged', () => {
const locationReferences: ReturnType<typeof useLocation>[] = [];

const TestComponentForMemo: React.FC<
TestComponentProps & { renderCount?: number }
> = ({ location }) => {
const TestComponentForMemo: React.FC<TestComponentProps> = ({
location,
}) => {
locationReferences.push(location);
return <div>Memoization test</div>;
};

const WrappedComponent = withRouterHooks(TestComponentForMemo);
const { rerender } = render(
<MemoryRouter>
<WrappedComponent renderCount={1} />
<WrappedComponent />
</MemoryRouter>,
);

// Force re-render with different prop
rerender(
<MemoryRouter>
<WrappedComponent renderCount={2} />
<WrappedComponent />
</MemoryRouter>,
);

Expand Down Expand Up @@ -278,9 +274,9 @@ describe('withRouterHooks HOC', () => {
// We change the mock values (not props) to exercise useShallowEqualityCheck.
const paramsReceived: ReturnType<typeof useParams>[] = [];

const TestComponentForMemo: React.FC<
TestComponentProps & { renderCount?: number }
> = ({ params }) => {
const TestComponentForMemo: React.FC<TestComponentProps> = ({
params,
}) => {
paramsReceived.push(params);
return <div>Comma collision test</div>;
};
Expand All @@ -291,7 +287,7 @@ describe('withRouterHooks HOC', () => {
const WrappedComponent = withRouterHooks(TestComponentForMemo);
const { rerender } = render(
<MemoryRouter>
<WrappedComponent renderCount={1} />
<WrappedComponent />
</MemoryRouter>,
);

Expand All @@ -300,7 +296,7 @@ describe('withRouterHooks HOC', () => {

rerender(
<MemoryRouter>
<WrappedComponent renderCount={2} />
<WrappedComponent />
</MemoryRouter>,
);

Expand All @@ -316,9 +312,9 @@ describe('withRouterHooks HOC', () => {
// React Router changes key on every navigation, even to the same path.
const locationsReceived: ReturnType<typeof useLocation>[] = [];

const TestComponentForMemo: React.FC<
TestComponentProps & { renderCount?: number }
> = ({ location }) => {
const TestComponentForMemo: React.FC<TestComponentProps> = ({
location,
}) => {
locationsReceived.push(location);
return <div>Location key test</div>;
};
Expand All @@ -329,7 +325,7 @@ describe('withRouterHooks HOC', () => {
const WrappedComponent = withRouterHooks(TestComponentForMemo);
const { rerender } = render(
<MemoryRouter>
<WrappedComponent renderCount={1} />
<WrappedComponent />
</MemoryRouter>,
);

Expand All @@ -338,7 +334,7 @@ describe('withRouterHooks HOC', () => {

rerender(
<MemoryRouter>
<WrappedComponent renderCount={2} />
<WrappedComponent />
</MemoryRouter>,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function GasFeeTokenToast() {
<Toast
onClose={hideToast}
text={t('confirmGasFeeTokenToast', [
<b>{selectedGasFeeToken?.symbol}</b>,
<b key="symbol">{selectedGasFeeToken?.symbol}</b>,
])}
startAdornment={
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ const DecodedSimulation: React.FC<object> = () => {
return Object.entries(stateChangesGrouped).flatMap(([_, changeList]) =>
changeList.map((change: DecodingDataStateChange, index: number) => (
<StateChangeRow
key={`${change.changeType}-${change.assetType}-${index}`}
stateChangeList={decodingData?.stateChanges ?? []}
stateChange={change}
chainId={chainId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const ConfirmInfoRowTypedSignData = ({
chainId,
}: {
data: string;
isPermit?: boolean;
tokenDecimals?: number;
chainId: string;
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const SnapInsight: React.FunctionComponent<SnapInsightProps> = ({
<Text>
{t('insightsFromSnap', [
<Text
key="snap-name"
fontWeight={FontWeight.Medium}
variant={TextVariant.inherit}
color={TextColor.inherit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { useI18nContext } from '../../../../../hooks/useI18nContext';
type RecipientFilterInputProps = {
searchQuery: string;
onChange: (value: string) => void;
placeholder?: string;
};

export const RecipientFilterInput = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export const Default: Story = {
approveConnection: (request) => {
console.log('Approved connection:', request);
},
activeTabOrigin: 'https://metamask.github.io',
targetSubjectMetadata: mockTargetSubjectMetadata,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const render = (
permissionsRequestId: '1',
rejectPermissionsRequest: jest.fn(),
approveConnection: jest.fn(),
activeTabOrigin: mockTestDappUrl,
targetSubjectMetadata: mockTargetSubjectMetadata,
},
state,
Expand Down Expand Up @@ -116,7 +115,6 @@ describe('ConnectPage', () => {
permissionsRequestId: '1',
rejectPermissionsRequest: jest.fn(),
approveConnection: jest.fn(),
activeTabOrigin: mockTestDappUrl,
targetSubjectMetadata: {
...mockTargetSubjectMetadata,
iconUrl: null,
Expand All @@ -135,7 +133,6 @@ describe('ConnectPage', () => {
permissionsRequestId: '1',
rejectPermissionsRequest: jest.fn(),
approveConnection: jest.fn(),
activeTabOrigin: mockTestDappUrl,
targetSubjectMetadata: {
...mockTargetSubjectMetadata,
iconUrl: null,
Expand Down Expand Up @@ -266,7 +263,6 @@ describe('ConnectPage', () => {
permissionsRequestId: '1',
rejectPermissionsRequest: jest.fn(),
approveConnection: jest.fn(),
activeTabOrigin: mockTestDappUrl,
targetSubjectMetadata: mockTargetSubjectMetadata,
},
});
Expand Down Expand Up @@ -311,7 +307,6 @@ describe('ConnectPage', () => {
permissionsRequestId: '1',
rejectPermissionsRequest: jest.fn(),
approveConnection: jest.fn(),
activeTabOrigin: mockTestDappUrl,
targetSubjectMetadata: mockTargetSubjectMetadata,
},
});
Expand Down Expand Up @@ -352,7 +347,6 @@ describe('ConnectPage', () => {
permissionsRequestId: '1',
rejectPermissionsRequest: jest.fn(),
approveConnection: jest.fn(),
activeTabOrigin: mockTestDappUrl,
targetSubjectMetadata: mockTargetSubjectMetadata,
},
});
Expand Down Expand Up @@ -393,7 +387,6 @@ describe('ConnectPage', () => {
permissionsRequestId: '1',
rejectPermissionsRequest: jest.fn(),
approveConnection: jest.fn(),
activeTabOrigin: mockTestDappUrl,
targetSubjectMetadata: mockTargetSubjectMetadata,
},
});
Expand Down Expand Up @@ -438,7 +431,6 @@ describe('ConnectPage', () => {
permissionsRequestId: '1',
rejectPermissionsRequest: jest.fn(),
approveConnection: jest.fn(),
activeTabOrigin: mockTestDappUrl,
targetSubjectMetadata: mockTargetSubjectMetadata,
},
});
Expand Down
1 change: 0 additions & 1 deletion ui/pages/permissions-connect/connect-page/connect-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export type ConnectPageProps = {
permissionsRequestId: string;
rejectPermissionsRequest: (id: string) => void;
approveConnection: (request: ConnectPageRequest) => void;
activeTabOrigin: string;
targetSubjectMetadata: {
extensionId: string | null;
iconUrl: string | null;
Expand Down
2 changes: 0 additions & 2 deletions ui/pages/permissions-connect/permissions-connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ function PermissionsConnect() {
const connectPageProps = {
rejectPermissionsRequest: (requestId: string) =>
cancelPermissionsRequest(requestId),
activeTabOrigin: origin,
request: permissionsRequest || {},
permissionsRequestId: permissionsRequestId || '',
approveConnection,
Expand All @@ -601,7 +600,6 @@ function PermissionsConnect() {
return <MultichainAccountsConnectPage {...connectPageProps} />;
}, [
cancelPermissionsRequest,
origin,
permissionsRequest,
permissionsRequestId,
approveConnection,
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/settings/developer-options-tab/sentry-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function GeneratePageCrash({ currentLocale }: { currentLocale: string }) {
description={
<span>
Trigger the crash on extension to send user feedback to sentry. You
can click "Try again" to reload extension
can click &quot;Try again&quot; to reload extension
</span>
}
onClick={handleClick}
Expand Down
Loading