From 4d065f33cc108f77b693e9b65f9a210ce6ffbb4f Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Fri, 10 Sep 2021 14:29:56 -0700 Subject: [PATCH] fix extra comments --- superset-frontend/src/dashboard/components/Dashboard.jsx | 2 +- superset-frontend/src/logger/LogUtils.ts | 8 ++++---- superset-frontend/src/views/App.tsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/superset-frontend/src/dashboard/components/Dashboard.jsx b/superset-frontend/src/dashboard/components/Dashboard.jsx index 0f107e596ce39..8a5e037983665 100644 --- a/superset-frontend/src/dashboard/components/Dashboard.jsx +++ b/superset-frontend/src/dashboard/components/Dashboard.jsx @@ -101,7 +101,7 @@ class Dashboard extends React.PureComponent { const bootstrapData = appContainer?.getAttribute('data-bootstrap') || ''; const { dashboardState, layout } = this.props; const eventData = { - is_soft_navigation: Logger.softNavigationStart > 0, + is_soft_navigation: Logger.timeOriginOffset > 0, is_edit_mode: dashboardState.editMode, mount_duration: Logger.getTimestamp(), is_empty: isDashboardEmpty(layout), diff --git a/superset-frontend/src/logger/LogUtils.ts b/superset-frontend/src/logger/LogUtils.ts index 9fe10dae494b5..9cdb5e4634bd5 100644 --- a/superset-frontend/src/logger/LogUtils.ts +++ b/superset-frontend/src/logger/LogUtils.ts @@ -59,14 +59,14 @@ export const LOG_EVENT_TYPE_USER = new Set([ ]); export const Logger = { - softNavigationStart: 0, + timeOriginOffset: 0, - resetStartTime() { - this.softNavigationStart = window.performance.now(); + markTimeOrigin() { + this.timeOriginOffset = window.performance.now(); }, // note that this returns ms since last navigation, NOT ms since epoch getTimestamp() { - return Math.round(window.performance.now() - this.softNavigationStart); + return Math.round(window.performance.now() - this.timeOriginOffset); }, }; diff --git a/superset-frontend/src/views/App.tsx b/superset-frontend/src/views/App.tsx index 00ad0f2c1b3ef..d04b08d93f147 100644 --- a/superset-frontend/src/views/App.tsx +++ b/superset-frontend/src/views/App.tsx @@ -58,7 +58,7 @@ const RootContextProviders: React.FC = ({ children }) => { // reset performance logger timer start point to avoid soft navigation // cause dashboard perf measurement problem if (lastLocationPathname && lastLocationPathname !== location.pathname) { - Logger.resetStartTime(); + Logger.markTimeOrigin(); } lastLocationPathname = location.pathname; }, [location.pathname]);