From 72ca3b5047791515a1dcc4948d81270e5190bfde Mon Sep 17 00:00:00 2001 From: Danica Shen Date: Thu, 28 Sep 2023 13:12:10 +0100 Subject: [PATCH] fix(000): fix lint for signature-request-siwe and metametrics --- .../signature-request-siwe.js | 2 +- .../component-library/box/box.types.ts | 1 - ui/contexts/metametrics.js | 31 ++++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ui/components/app/signature-request-siwe/signature-request-siwe.js b/ui/components/app/signature-request-siwe/signature-request-siwe.js index 7a43baa785fe..602aa2fe7141 100644 --- a/ui/components/app/signature-request-siwe/signature-request-siwe.js +++ b/ui/components/app/signature-request-siwe/signature-request-siwe.js @@ -104,7 +104,7 @@ export default function SignatureRequestSIWE({ txData }) { } catch (e) { log.error(e); } - }, []); + }, [dispatch, id]); const handleCancelAll = () => { const unapprovedTxCount = messagesCount; diff --git a/ui/components/component-library/box/box.types.ts b/ui/components/component-library/box/box.types.ts index 49a2c894e761..46fa1404d05c 100644 --- a/ui/components/component-library/box/box.types.ts +++ b/ui/components/component-library/box/box.types.ts @@ -79,7 +79,6 @@ export type StylePropValueType = | TextAlignArray | TextColor | TextColorArray - | IconColor | IconColorArray | undefined; diff --git a/ui/contexts/metametrics.js b/ui/contexts/metametrics.js index ac1f0c776a8b..ea9444b3b6d1 100644 --- a/ui/contexts/metametrics.js +++ b/ui/contexts/metametrics.js @@ -59,19 +59,22 @@ export function MetaMetricsProvider({ children }) { const context = useSegmentContext(); // Sometimes we want to track context properties inside the event's "properties" object. - const addContextPropsIntoEventProperties = (payload, options) => { - const fields = options?.contextPropsIntoEventProperties; - if (!fields || fields.length === 0) { - return; - } - if (!payload.properties) { - payload.properties = {}; - } - if (fields.includes(MetaMetricsContextProp.PageTitle)) { - payload.properties[MetaMetricsContextProp.PageTitle] = - context.page?.title; - } - }; + const addContextPropsIntoEventProperties = useCallback( + (payload, options) => { + const fields = options?.contextPropsIntoEventProperties; + if (!fields || fields.length === 0) { + return; + } + if (!payload.properties) { + payload.properties = {}; + } + if (fields.includes(MetaMetricsContextProp.PageTitle)) { + payload.properties[MetaMetricsContextProp.PageTitle] = + context.page?.title; + } + }, + [context.page?.title], + ); /** * @type {UITrackEventMethod} @@ -88,7 +91,7 @@ export function MetaMetricsProvider({ children }) { options, ); }, - [context], + [addContextPropsIntoEventProperties, context], ); // Used to prevent double tracking page calls