Skip to content

Commit

Permalink
Add isInitialRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet committed Dec 3, 2020
1 parent 6d8e515 commit cefc4ec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"@elastic/datemath": "link:packages/elastic-datemath",
"@elastic/elasticsearch": "7.10.0-rc.1",
"@elastic/ems-client": "7.11.0",
"@elastic/eui": "30.2.0",
"@elastic/eui": "30.3.0",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana2",
"@elastic/node-crypto": "1.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
const [totalInactiveAgents, setTotalInactiveAgents] = useState(0);

// Request to fetch agents and agent status
const currentRequestRef = useRef<any>();
const currentRequestRef = useRef<number>(0);
const fetchData = useCallback(() => {
async function fetchDataAsync() {
const currentRequest = {};
currentRequestRef.current = currentRequest;
currentRequestRef.current++;
const currentRequest = currentRequestRef.current;

try {
setIsLoading(true);
Expand Down Expand Up @@ -568,7 +568,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
loading={isLoading}
hasActions={true}
noItemsMessage={
isLoading && false ? ( // TODO isInitialRequest
isLoading && currentRequestRef.current === 1 ? (
<FormattedMessage
id="xpack.fleet.agentList.loadingAgentsMessage"
defaultMessage="Loading agents…"
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1433,10 +1433,10 @@
resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314"
integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ==

"@elastic/eui@30.2.0":
version "30.2.0"
resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-30.2.0.tgz#17bc630eb1a03e05d453b9934568cfbf3a82b736"
integrity sha512-VUmy7Qz49kN8a3f58bilfMwBo9zCJvHyBOUdDA1O77jFYv3+Hg7e/+uGb7Q1k6kSmCfv4r99eZWrcxVroYU4nQ==
"@elastic/eui@30.3.0":
version "30.3.0"
resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-30.3.0.tgz#7e408e17668dcb33f14a08930aa39f6066a1c437"
integrity sha512-7rw9+8IOnMUmCRMHl5PyI2JPLt41xDE4VBmuVxBB/LSImArnQvQKlPeEzpYM6QGpcaOBUUNkx83oSGmSvwOQdA==
dependencies:
"@types/chroma-js" "^2.0.0"
"@types/lodash" "^4.14.160"
Expand Down

0 comments on commit cefc4ec

Please sign in to comment.