From fb80d34b3b03023da64e256ff662c8ed478eae6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ey=C3=BE=C3=B3r=20Magn=C3=BAsson?= Date: Mon, 18 Nov 2019 13:47:46 -0800 Subject: [PATCH] fix(dashboard): fix hooks render order on logs page The conditional calling of a hook was causing the following error: https://stackoverflow.com/q/55622768/5629940 --- dashboard/package.json | 2 +- dashboard/src/containers/logs.tsx | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dashboard/package.json b/dashboard/package.json index a582a887ba..a0e3654c30 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -54,7 +54,7 @@ "build": "react-scripts build && ./bin/copy-to-static", "dev": "EXTEND_ESLINT=true npm run start", "fix-format": "prettier --write \"{src,test}/**/*.{ts,tsx}\"", - "lint": "tslint -p .", + "lint": "eslint \"{src,test}/**/*.{ts,tsx}\"", "test-watch": "react-scripts test", "test": "CI=true react-scripts test", "eject": "react-scripts eject" diff --git a/dashboard/src/containers/logs.tsx b/dashboard/src/containers/logs.tsx index 5d2c720902..75f818f34f 100644 --- a/dashboard/src/containers/logs.tsx +++ b/dashboard/src/containers/logs.tsx @@ -36,6 +36,13 @@ export default () => { } }, [dispatch, requestStates.logs, serviceNames]) + const handleRefresh = useCallback( + (names: string[]) => { + loadLogs(dispatch, names) + }, + [dispatch] + ) + if (!(requestStates.config.initLoadComplete && requestStates.logs.initLoadComplete)) { return } @@ -44,12 +51,5 @@ export default () => { return } - const handleRefresh = useCallback( - (names: string[]) => { - loadLogs(dispatch, names) - }, - [dispatch] - ) - return }