diff --git a/ui/package-lock.json b/ui/package-lock.json index 083e37e..7532e54 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -296,15 +296,6 @@ "@types/react": "*" } }, - "@types/react-list": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/@types/react-list/-/react-list-0.8.4.tgz", - "integrity": "sha512-eOq+wGLJ4ToxonMBXeqWRmta0is5uvvtzQOstFDLlDbbSiKUb8e7oCqZ0Yx0y864TDyAHmOGsmftSqpc1A7Sjw==", - "dev": true, - "requires": { - "@types/react": "*" - } - }, "@types/react-router": { "version": "4.0.30", "resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-4.0.30.tgz", @@ -9597,14 +9588,6 @@ "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" }, - "react-list": { - "version": "0.8.10", - "resolved": "https://registry.npmjs.org/react-list/-/react-list-0.8.10.tgz", - "integrity": "sha512-7jzShUoyzPp7NxzEs46vs5H1SmNSbPX2jK35KA3CrT43Fv4yYyovWm5lb0CtDIPHeLKf8rTmGOaZQPV9HvoG2w==", - "requires": { - "prop-types": "15" - } - }, "react-router": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/react-router/-/react-router-4.3.1.tgz", diff --git a/ui/package.json b/ui/package.json index 100f9ae..2447ef8 100644 --- a/ui/package.json +++ b/ui/package.json @@ -15,7 +15,6 @@ "prop-types": "^15.6.2", "react": "^16.4.2", "react-dom": "^16.4.2", - "react-list": "^0.8.10", "react-router": "^4.3.1", "react-router-dom": "^4.3.1", "react-scripts-ts": "2.17.0", @@ -43,7 +42,6 @@ "@types/puppeteer": "^1.6.3", "@types/react": "^16.4.11", "@types/react-dom": "^16.0.7", - "@types/react-list": "^0.8.4", "@types/react-router-dom": "^4.3.0", "@types/rimraf": "^2.0.2", "get-port": "^4.0.0", diff --git a/ui/src/component/FixedReactList.tsx b/ui/src/component/FixedReactList.tsx deleted file mode 100644 index 920d8a6..0000000 --- a/ui/src/component/FixedReactList.tsx +++ /dev/null @@ -1,50 +0,0 @@ -// @ts-ignore -import ReactList from 'react-list'; - -// See also https://github.com/coderiety/react-list/blob/master/react-list.es6 -class FixedReactList extends ReactList { - // deleting a messages or adding a message (per shift) requires invalidating the cache, react-list sucks as it does - // not provide such functionality, therefore we need to hack it inside there :( - public ignoreNextCacheUpdate = false; - - public cacheSizes(): void { - if (this.ignoreNextCacheUpdate) { - this.ignoreNextCacheUpdate = false; - return; - } - // @ts-ignore accessing private member - super.cacheSizes(); - } - - public clearCacheFromIndex(startIndex: number): void { - this.ignoreNextCacheUpdate = true; - - if (startIndex === 0) { - // @ts-ignore accessing private member - this.cache = {}; - } else { - // @ts-ignore accessing private member - Object.keys(this.cache) - .filter((index) => +index >= startIndex) - .forEach((index) => { - // @ts-ignore accessing private member - delete this.cache[index]; - }); - } - } - - public componentDidUpdate() { - const hasCacheForLastRenderedItem = - // @ts-ignore accessing private member - Object.keys(this.cache).length && this.cache[this.getVisibleRange()[1]]; - // @ts-ignore accessing private member - super.componentDidUpdate(); - if (!hasCacheForLastRenderedItem) { - // when there is no cache for the last rendered item, then its a new item, react-list doesn't know it size - // and cant correctly calculate the height of the list, we force a rerender where react-list knows the size. - this.forceUpdate(); - } - } -} - -export default FixedReactList;