* only refresh view when the server URL changes (MM-34565) Create views of current and incoming tabs indexed by unique [URL, TABTYPE] tuples, and diffing them. Tuples that are identical are recycled, merely porting the new server name over. * lint fixes * WIP * linting * remove dependency on by, duad * provide a more exaplanatory name for TabView.prototype.tuple (urlTypeTuple) * minor improvements in viewManager - remove stateful behaviour from makeView - more descriptive variable names when looping - create new arrays before sorting (sort is in-place by default) * resolve linting errors
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Tuple as tuple} from '@bloomberg/record-tuple-polyfill';
|
||||
|
||||
import {MattermostServer} from 'common/servers/MattermostServer';
|
||||
|
||||
import {getTabViewName, TabType, TabView} from './TabView';
|
||||
import {getTabViewName, TabType, TabView, TabTuple} from './TabView';
|
||||
|
||||
export default abstract class BaseTabView implements TabView {
|
||||
server: MattermostServer;
|
||||
@@ -14,6 +16,9 @@ export default abstract class BaseTabView implements TabView {
|
||||
get name(): string {
|
||||
return getTabViewName(this.server.name, this.type);
|
||||
}
|
||||
get urlTypeTuple(): TabTuple {
|
||||
return tuple(this.url.href, this.type) as TabTuple;
|
||||
}
|
||||
get url(): URL {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ export const TAB_MESSAGING = 'TAB_MESSAGING';
|
||||
export const TAB_FOCALBOARD = 'TAB_FOCALBOARD';
|
||||
export const TAB_PLAYBOOKS = 'TAB_PLAYBOOKS';
|
||||
export type TabType = typeof TAB_MESSAGING | typeof TAB_FOCALBOARD | typeof TAB_PLAYBOOKS;
|
||||
export type TabTuple = [string, TabType];
|
||||
|
||||
export interface TabView {
|
||||
server: MattermostServer;
|
||||
@@ -21,6 +22,7 @@ export interface TabView {
|
||||
get type(): TabType;
|
||||
get url(): URL;
|
||||
get shouldNotify(): boolean;
|
||||
get urlTypeTuple(): TabTuple;
|
||||
}
|
||||
|
||||
export function getDefaultTeamWithTabsFromTeam(team: Team) {
|
||||
|
Reference in New Issue
Block a user