Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Weblate 2018-05-03 17:46:25 +00:00
commit 3cc21d5701
2 changed files with 12 additions and 4 deletions

View File

@ -164,9 +164,6 @@ class Analytics {
}
trackPageChange(generationTimeMs) {
if (typeof generationTimeMs !== 'number') {
throw new Error('Analytics.trackPageChange: expected generationTimeMs to be a number');
}
if (this.disabled) return;
if (this.firstPage) {
// De-duplicate first page
@ -174,8 +171,15 @@ class Analytics {
this.firstPage = false;
return;
}
if (typeof generationTimeMs === 'number') {
this._paq.push(['setGenerationTimeMs', generationTimeMs]);
} else {
console.warn('Analytics.trackPageChange: expected generationTimeMs to be a number');
// But continue anyway because we still want to track the change
}
this._paq.push(['setCustomUrl', getRedactedUrl()]);
this._paq.push(['setGenerationTimeMs', generationTimeMs]);
this._paq.push(['trackPageView']);
}

View File

@ -413,6 +413,10 @@ export default React.createClass({
performance.clearMarks('riot_MatrixChat_page_change_start');
performance.clearMarks('riot_MatrixChat_page_change_stop');
const measurement = performance.getEntriesByName('riot_MatrixChat_page_change_delta').pop();
// In practice, sometimes the entries list is empty, so we get no measurement
if (!measurement) return null;
return measurement.duration;
},