forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MM-41827 Count preloaded channels on first team load (mattermost#9908)
Co-authored-by: Mattermod <[email protected]>
- Loading branch information
Showing
5 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {Dispatch} from 'redux'; | ||
|
||
import {getChannelIdsForCurrentTeam} from 'mattermost-redux/selectors/entities/channels'; | ||
|
||
import {trackEvent} from 'actions/telemetry_actions'; | ||
|
||
import {GlobalState} from 'types/store'; | ||
|
||
let isFirstPreload = true; | ||
|
||
export function trackPreloadedChannels(prefetchQueueObj: Record<string, string[]>) { | ||
return (dispatch: Dispatch, getState: () => GlobalState) => { | ||
const state = getState(); | ||
const channelIdsForTeam = getChannelIdsForCurrentTeam(state); | ||
|
||
trackEvent('performance', 'preloaded_channels', { | ||
numHigh: prefetchQueueObj[1]?.length || 0, | ||
numMedium: prefetchQueueObj[2]?.length || 0, | ||
numLow: prefetchQueueObj[3]?.length || 0, | ||
|
||
numTotal: channelIdsForTeam.length, | ||
|
||
// Tracks whether this is the first team that we've preloaded channels for in this session since | ||
// the first preload will likely include DMs and GMs | ||
isFirstPreload, | ||
}); | ||
|
||
isFirstPreload = false; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters