only refresh view when the server URL changes (MM-34565) (#2082) (#2094)

* 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:
vas
2022-05-20 18:06:43 +03:00
committed by GitHub
parent d74dba5bad
commit 4efac368d5
8 changed files with 179 additions and 62 deletions

View File

@@ -0,0 +1,16 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
declare module '@bloomberg/record-tuple-polyfill' {
export function Tuple<A>(A): [A];
export function Tuple<A, B>(a: A, b: B): [A, B];
export function Tuple<A, B, C>(a: A, b: B, c: C): [A, B, C];
export function Tuple<A, B, C, D>(a: A, b: B, c: C, d: D): [A, B, C, D];
export function Tuple<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): [A, B, C, D, E];
export function Tuple<A, B, C, D, E, F>(a: A, b: B, c: C, d: D, e: E, f: F): [A, B, C, D, E, F];
export function Tuple<A, B, C, D, E, F, G>(a: A, b: B, c: C, d: D, e: E, f: F, g: G): [A, B, C, D, E, F, G];
export function Tuple<A, B, C, D, E, F, G, H>(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): [A, B, C, D, E, F, G, H];
export function Tuple<A, B, C, D, E, F, G, H, I>(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I): [A, B, C, D, E, F, G, H, I];
export function Tuple<A, B, C, D, E, F, G, H, I, J>(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J): [A, B, C, D, E, F, G, H, I, J];
export function Record<T>(x: {[key: string]: T}): {[key: string]: T};
}