From cb4a523799618b07379c0df2fe29bc0d48e69c8c Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Mon, 25 Sep 2023 10:15:18 +0200 Subject: [PATCH 1/2] Resolved conflicts. --- src/libs/Firebase/index.ts | 4 ++-- src/libs/actions/{Timing.js => Timing.ts} | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) rename src/libs/actions/{Timing.js => Timing.ts} (76%) diff --git a/src/libs/Firebase/index.ts b/src/libs/Firebase/index.ts index 3048cf1d9bd8..bc39c67f0674 100644 --- a/src/libs/Firebase/index.ts +++ b/src/libs/Firebase/index.ts @@ -1,8 +1,8 @@ import {StartTrace, StopTrace} from './types'; /** Web does not use Firebase for performance tracing */ -const startTrace: StartTrace = () => {}; -const stopTrace: StopTrace = () => {}; +const startTrace: StartTrace = (customEventName: string) => {}; +const stopTrace: StopTrace = (customEventName: string) => {}; export default { startTrace, diff --git a/src/libs/actions/Timing.js b/src/libs/actions/Timing.ts similarity index 76% rename from src/libs/actions/Timing.js rename to src/libs/actions/Timing.ts index 2be2cdc6fa63..13f40bab87c9 100644 --- a/src/libs/actions/Timing.js +++ b/src/libs/actions/Timing.ts @@ -4,15 +4,20 @@ import Firebase from '../Firebase'; import * as API from '../API'; import Log from '../Log'; -let timestampData = {}; +type TimestampData = { + startTime: number; + shouldUseFirebase: boolean; +}; + +let timestampData: Record = {}; /** * Start a performance timing measurement * - * @param {String} eventName - * @param {Boolean} shouldUseFirebase - adds an additional trace in Firebase + * @param eventName + * @param shouldUseFirebase - adds an additional trace in Firebase */ -function start(eventName, shouldUseFirebase = false) { +function start(eventName: string, shouldUseFirebase = false) { timestampData[eventName] = {startTime: Date.now(), shouldUseFirebase}; if (!shouldUseFirebase) { @@ -25,11 +30,11 @@ function start(eventName, shouldUseFirebase = false) { /** * End performance timing. Measure the time between event start/end in milliseconds, and push to Grafana * - * @param {String} eventName - event name used as timestamp key - * @param {String} [secondaryName] - optional secondary event name, passed to grafana - * @param {number} [maxExecutionTime] - optional amount of time (ms) to wait before logging a warn + * @param eventName - event name used as timestamp key + * @param [secondaryName] - optional secondary event name, passed to grafana + * @param [maxExecutionTime] - optional amount of time (ms) to wait before logging a warn */ -function end(eventName, secondaryName = '', maxExecutionTime = 0) { +function end(eventName: string, secondaryName = '', maxExecutionTime = 0) { if (!timestampData[eventName]) { return; } From b3a8a2696a5f7521bec483dce1d7f55ff61fc0ae Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Fri, 13 Oct 2023 11:43:52 +0200 Subject: [PATCH 2/2] Fixed linter issues. --- src/libs/Firebase/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/Firebase/index.ts b/src/libs/Firebase/index.ts index bc39c67f0674..3048cf1d9bd8 100644 --- a/src/libs/Firebase/index.ts +++ b/src/libs/Firebase/index.ts @@ -1,8 +1,8 @@ import {StartTrace, StopTrace} from './types'; /** Web does not use Firebase for performance tracing */ -const startTrace: StartTrace = (customEventName: string) => {}; -const stopTrace: StopTrace = (customEventName: string) => {}; +const startTrace: StartTrace = () => {}; +const stopTrace: StopTrace = () => {}; export default { startTrace,