MM-50122 : Remove and test refetching of channels on browser focus change (#22973)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6ca5824ea1
Коммит
7b9d43e308
@@ -6887,6 +6887,15 @@ const AdminDefinition = {
|
||||
isHidden: it.licensedForFeature('Cloud'),
|
||||
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
|
||||
},
|
||||
{
|
||||
type: Constants.SettingsTypes.TYPE_BOOL,
|
||||
key: 'ExperimentalSettings.DisableRefetchingOnBrowserFocus',
|
||||
label: t('admin.experimental.disableRefetchingOnBrowserFocus.title'),
|
||||
label_default: 'Disable data refetching on browser refocus:',
|
||||
help_text: t('admin.experimental.disableRefetchingOnBrowserFocus.desc'),
|
||||
help_text_default: 'When true, Mattermost will not refetch channels and channel members when the browser regains focus. This may result in improved performance for users with many channels and channel members.',
|
||||
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
@@ -36,6 +36,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
|
||||
const currentUser = getCurrentUser(state);
|
||||
const plugins = state.plugins.components.NeedsTeamComponent;
|
||||
const graphQLEnabled = isGraphQLEnabled(state);
|
||||
const disableRefetchingOnBrowserFocus = config.DisableRefetchingOnBrowserFocus === 'true';
|
||||
|
||||
return {
|
||||
currentUser,
|
||||
@@ -46,6 +47,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
|
||||
selectedThreadId: getSelectedThreadIdInCurrentTeam(state),
|
||||
mfaRequired: checkIfMFARequired(currentUser, license, config, ownProps.match.url),
|
||||
graphQLEnabled,
|
||||
disableRefetchingOnBrowserFocus,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ function TeamController(props: Props) {
|
||||
const wakeUpIntervalId = setInterval(() => {
|
||||
const currentTime = Date.now();
|
||||
if ((currentTime - lastTime.current) > WAKEUP_THRESHOLD) {
|
||||
console.log('computer woke up - fetching latest'); //eslint-disable-line no-console
|
||||
console.log('computer woke up - reconnecting'); //eslint-disable-line no-console
|
||||
reconnect();
|
||||
}
|
||||
lastTime.current = currentTime;
|
||||
@@ -92,12 +92,15 @@ function TeamController(props: Props) {
|
||||
props.markChannelAsReadOnFocus(props.currentChannelId);
|
||||
}
|
||||
|
||||
const currentTime = Date.now();
|
||||
if ((currentTime - blurTime.current) > UNREAD_CHECK_TIME_MILLISECONDS && props.currentTeamId) {
|
||||
if (props.graphQLEnabled) {
|
||||
props.fetchChannelsAndMembers(props.currentTeamId);
|
||||
} else {
|
||||
props.fetchMyChannelsAndMembersREST(props.currentTeamId);
|
||||
// Temporary flag to disable refetching of channel members on browser focus
|
||||
if (!props.disableRefetchingOnBrowserFocus) {
|
||||
const currentTime = Date.now();
|
||||
if ((currentTime - blurTime.current) > UNREAD_CHECK_TIME_MILLISECONDS && props.currentTeamId) {
|
||||
if (props.graphQLEnabled) {
|
||||
props.fetchChannelsAndMembers(props.currentTeamId);
|
||||
} else {
|
||||
props.fetchMyChannelsAndMembersREST(props.currentTeamId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user