Skip to content

Commit dd36f79

Browse files
committed
Removed unnecessary state hook. Fixed how data from IPC DetailsResponse was handled.
1 parent 41caa7b commit dd36f79

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

app/components/ServiceDetails.jsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,24 @@ import React, { useEffect, useState, useContext } from 'react';
22
import HealthInformationContext from '../context/DetailsContext';
33
import RequestTypesChart from '../charts/request-type-chart.jsx';
44
import ResponseCodesChart from '../charts/response-code-chart.jsx';
5-
import SpeedChart from '../charts/speed-chart.jsx';
5+
// import SpeedChart from '../charts/speed-chart.jsx';
6+
import MemoryChart from '../charts/memory-chart.jsx';
67

78
const { ipcRenderer } = window.require('electron');
89

910
const ServiceDetails = (props) => {
1011
const healthdata = useContext(HealthInformationContext);
11-
const [detailsState, setDetails] = useState();
12-
1312

1413
useEffect(() => {
1514
// IPC communication used to initiate query for information on microservices.
1615
ipcRenderer.send('detailsRequest', props.index);
17-
16+
1817
// IPC listener responsible for retrieving infomation from asynchronous main process message.
1918
ipcRenderer.on('detailsResponse', (event, data) => {
20-
setDetails(Object.values(JSON.parse(data)));
21-
healthdata.detailData = detailsState;
19+
healthdata.detailData = [...JSON.parse(data)];
2220
});
2321
}, []);
24-
25-
console.log(detailsState);
22+
2623
return (
2724
<div>
2825
<div>
@@ -34,8 +31,8 @@ const ServiceDetails = (props) => {
3431
<ResponseCodesChart />
3532
</div>
3633
<div>
37-
{/* <h3>Speed Chart</h3>
38-
<SpeedChart /> */}
34+
<h3>Memory Chart</h3>
35+
<MemoryChart />
3936
</div>
4037
</div>
4138
);

0 commit comments

Comments
 (0)