diff --git a/CHANGELOG.md b/CHANGELOG.md index e129a1d48a..38db5b49c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Deleting a single entity now removes its ID from store [#1839](https://github.com/greenbone/gsa/pull/1839) ### Fixed +- Fixed "Hosts scanned" in report details disappearing during page refresh [#2357](https://github.com/greenbone/gsa/pull/2357) - Fixed schedule_periods not forwarded if there is no schedule [#2331](https://github.com/greenbone/gsa/pull/2331) - Fixed broken radio buttons in alert dialog [#2326](https://github.com/greenbone/gsa/pull/2326) - Fixed report formats undeletable and unrestorable [#2321](https://github.com/greenbone/gsa/pull/2321) diff --git a/gsa/src/web/pages/reports/details/summary.js b/gsa/src/web/pages/reports/details/summary.js index 5654350ee5..ff51e7a2f0 100644 --- a/gsa/src/web/pages/reports/details/summary.js +++ b/gsa/src/web/pages/reports/details/summary.js @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import React from 'react'; +import React, {useState, useEffect} from 'react'; import styled from 'styled-components'; @@ -100,8 +100,13 @@ const Summary = ({ const {id, name, comment, progress} = task; - const hosts_count = - isDefined(hosts) && isDefined(hosts.counts) ? hosts.counts.all : 0; + const [hostsCount, setHostsCount] = useState(0); + + useEffect(() => { + if (isDefined(hosts?.counts?.all)) { + setHostsCount(hosts.counts.all); + } + }, [hosts]); const filterString = isDefined(filter) ? filter.simple().toFilterString() @@ -244,10 +249,10 @@ const Summary = ({ {slave.name} )} - {hosts_count > 0 && ( + {hostsCount > 0 && ( {_('Hosts scanned')} - {hosts_count} + {hostsCount} )}