Fix: crash on latest react-table

This commit is contained in:
Dreamacro 2020-04-03 10:54:06 +08:00
parent f8fca04be8
commit a2f16db405
3 changed files with 9560 additions and 1721 deletions

11275
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,7 @@
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-standard": "^4.0.1",
"file-loader": "^6.0.0",
"html-webpack-plugin": "^4.0.3",
"html-webpack-plugin": "^4.0.4",
"image-webpack-loader": "^6.0.0",
"mini-css-extract-plugin": "^0.9.0",
"offline-plugin": "^5.0.7",
@ -89,7 +89,7 @@
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.1.2",
"react-table": "^7.0.0-rc.16",
"react-table": "^7.0.2",
"react-virtualized-auto-sizer": "^1.0.2",
"react-window": "^1.8.5",
"swr": "^0.2.0",

View File

@ -1,4 +1,4 @@
import React, { useEffect, useMemo } from 'react'
import React, { useMemo, useLayoutEffect } from 'react'
import { useBlockLayout, useResizeColumns, useTable } from 'react-table'
import classnames from 'classnames'
import { Header, Card, Checkbox, Modal, Icon } from '@components'
@ -63,7 +63,7 @@ function formatSpeed (upload: number, download: number) {
export default function Connections () {
const { useTranslation, lang } = containers.useI18n()
const { t } = useTranslation('Connections')
const t = useMemo(() => useTranslation('Connections').t, [useTranslation])
// total
const [traffic, setTraffic] = useObject({
@ -138,9 +138,9 @@ export default function Connections () {
minWidth: c[1],
width: c[1]
})
), [lang, t])
), [t])
useEffect(() => {
useLayoutEffect(() => {
const streamReader: StreamReader<API.Snapshot> = null
function handleConnection (snapshots: API.Snapshot[]) {