File tree Expand file tree Collapse file tree 6 files changed +9
-5
lines changed
Expand file tree Collapse file tree 6 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ const Occupied: React.FC = React.memo(function Occupied (props) {
6969 if ( delRef . current [ i ] && ! delRef . current [ i ] . contains ( event . target ) ) {
7070 setIndex ( i ) ;
7171 setApp ( selectedApp ) ;
72+ setServicesData ( [ ] ) ;
7273 setOpen ( true ) ;
7374 }
7475 } ;
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export interface GraphsContainerProps {
3131 } ;
3232}
3333
34- const GraphsContainer : React . SFC < GraphsContainerProps > = ( ) => {
34+ const GraphsContainer : React . FC < GraphsContainerProps > = React . memo ( function GraphsContainer ( props ) {
3535 const { app, service } = useParams < any > ( ) ;
3636 const [ live , setLive ] = useState < boolean > ( false ) ;
3737 const [ intervalID , setIntervalID ] = useState < NodeJS . Timeout | null > ( null ) ;
@@ -88,6 +88,6 @@ const GraphsContainer: React.SFC<GraphsContainerProps> = () => {
8888 </ div >
8989 </ >
9090 ) ;
91- } ;
91+ } ) ;
9292
9393export default GraphsContainer ;
Original file line number Diff line number Diff line change @@ -16,13 +16,14 @@ const CommsContextProvider: React.FC = ({ children }) => {
1616 const [ currentApp , setCurrentApp ] = useState ( '' ) ;
1717
1818 // Fetches all data related to communication for a particular app
19- const fetchCommsData = ( app : string , live : boolean ) => {
19+ const fetchCommsData = React . useCallback ( ( app : string , live : boolean ) => {
2020 /**
2121 * Caches results of requesting communication data for a specific app
2222 * Communication data will be the same across the microservices. Prevents
2323 * fetch requests that result in repeating data
2424 */
2525 if ( app !== currentApp || live ) {
26+ ipcRenderer . removeAllListeners ( 'commsResponse' ) ;
2627 setCurrentApp ( app )
2728 ipcRenderer . send ( 'commsRequest' , app ) ;
2829 ipcRenderer . on ( 'commsResponse' , ( event : Electron . Event , data : any ) => {
@@ -32,7 +33,7 @@ const CommsContextProvider: React.FC = ({ children }) => {
3233 setCommsData ( result ) ;
3334 } ) ;
3435 }
35- } ;
36+ } , [ ] ) ;
3637
3738 return (
3839 < CommsContext . Provider value = { { commsData, setCommsData, fetchCommsData } } >
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const DockerContextProvider: React.FC = ({ children }) => {
1818
1919 // Fetches all data related to a particular app
2020 const fetchDockerData = ( service : string ) => {
21+ ipcRenderer . removeAllListeners ( 'dockerResponse' ) ;
2122 ipcRenderer . send ( 'dockerRequest' , service ) ;
2223
2324 ipcRenderer . on ( 'dockerResponse' , ( event : Electron . Event , data : any ) => {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ const HealthContextProvider: React.FC = ({ children }) => {
1515
1616 // Fetches all data related to a particular app
1717 const fetchHealthData = ( service : string ) => {
18+ ipcRenderer . removeAllListeners ( 'healthResponse' ) ;
1819 ipcRenderer . send ( 'healthRequest' , service ) ;
1920 ipcRenderer . on ( 'healthResponse' , ( event : Electron . Event , data : any ) => {
2021 let result : any ;
Original file line number Diff line number Diff line change 1313 "test:electron" : " jest --detectOpenHandles ./__tests__/electron/*" ,
1414 "test:app" : " jest ./__tests__/app/*" ,
1515 "both" : " npm run start & sleep 5 && npm run electron" ,
16- "both:tsc" : " nodemon --watch ./app & npm run start & sleep 5 && npm run electron" ,
16+ "both:tsc" : " nodemon --watch ./app & ( npm run start && sleep 5 && npm run electron) " ,
1717 "both:dev" : " npm run start & nodemon --watch ./electron --exec 'npm run electron'" ,
1818 "package-mac" : " electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds" ,
1919 "create-installer-mac" : " electron-installer-dmg ./release-builds/chronos-darwin-x64/chronos.app/ Chronos" ,
You can’t perform that action at this time.
0 commit comments