Skip to content

Commit

Permalink
fix extra comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo committed Sep 10, 2021
1 parent a27f4e0 commit 4d065f3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion superset-frontend/src/dashboard/components/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 4 additions & 4 deletions superset-frontend/src/logger/LogUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
};
2 changes: 1 addition & 1 deletion superset-frontend/src/views/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 4d065f3

Please sign in to comment.