Skip to content

Commit

Permalink
minor ts improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Jun 7, 2024
1 parent 5fba3ae commit d55da59
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/lib/lantern/lantern.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ function createProcessedNavigation(traceEngineResult) {
throw new Error('missing metric scores for main frame');
}

const lastNavigationId = Meta.mainFrameNavigations.at(-1)?.args.data?.navigationId ?? '';
const scores = scoresByNav.get(lastNavigationId);
const lastNavigationId = Meta.mainFrameNavigations.at(-1)?.args.data?.navigationId;
const scores = lastNavigationId && scoresByNav.get(lastNavigationId);
if (!scores) {
throw new Error('missing metric scores for specified navigation');
}

/** @param {MetricName} metric */
const getTimestampOrUndefined = metric => {
const metricScore = scores?.get(metric);
const metricScore = scores.get(metric);
if (!metricScore?.event) return;
return metricScore.event.ts;
};
/** @param {MetricName} metric */
const getTimestamp = metric => {
const metricScore = scores?.get(metric);
const metricScore = scores.get(metric);
if (!metricScore?.event) throw new Error(`missing metric: ${metric}`);
return metricScore.event.ts;
};
Expand Down

0 comments on commit d55da59

Please sign in to comment.