Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo committed Sep 10, 2021
1 parent f661d45 commit a27f4e0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions superset-frontend/src/dashboard/components/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +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_edit_mode: dashboardState.editMode,
mount_duration: Logger.getTimestamp(),
is_empty: isDashboardEmpty(layout),
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/logger/LogUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const Logger = {
this.softNavigationStart = window.performance.now();
},

// note that this returns ms since page load, NOT ms since epoch
// note that this returns ms since last navigation, NOT ms since epoch
getTimestamp() {
return Math.round(window.performance.now() - this.softNavigationStart);
},
Expand Down
8 changes: 4 additions & 4 deletions superset-frontend/src/views/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { theme } from 'src/preamble';
import ToastPresenter from 'src/messageToasts/containers/ToastPresenter';
import setupApp from 'src/setup/setupApp';
import { routes, isFrontendRoute } from 'src/views/routes';
import { Logger } from '../logger/LogUtils';
import { Logger } from 'src/logger/LogUtils';
import { store } from './store';

setupApp();
Expand All @@ -49,18 +49,18 @@ const bootstrap = JSON.parse(container?.getAttribute('data-bootstrap') ?? '{}');
const user = { ...bootstrap.user };
const menu = { ...bootstrap.common.menu_data };
const common = { ...bootstrap.common };
let lastLocation: string;
let lastLocationPathname: string;
initFeatureFlags(bootstrap.common.feature_flags);

const RootContextProviders: React.FC = ({ children }) => {
const location = useLocation();
useEffect(() => {
// reset performance logger timer start point to avoid soft navigation
// cause dashboard perf measurement problem
if (lastLocation && lastLocation !== location.pathname) {
if (lastLocationPathname && lastLocationPathname !== location.pathname) {
Logger.resetStartTime();
}
lastLocation = location.pathname;
lastLocationPathname = location.pathname;
}, [location.pathname]);

return (
Expand Down

0 comments on commit a27f4e0

Please sign in to comment.