@@ -34,7 +34,6 @@ const AppLogs = React.forwardRef(({ filteredServices }, ref) => {
3434 const logContentRef = useRef ( )
3535 const [ lastScrollTop , setLastScrollTop ] = useState ( 0 )
3636 const [ displayGoToBottom , setDisplayGoToBottom ] = useState ( false )
37- const [ showPreviousLogs ] = useState ( false )
3837 const [ statusPausedLogs , setStatusPausedLogs ] = useState ( '' )
3938 const [ filteredLogsLengthAtPause , setFilteredLogsLengthAtPause ] = useState ( 0 )
4039 const bottomRef = useRef ( )
@@ -110,10 +109,13 @@ const AppLogs = React.forwardRef(({ filteredServices }, ref) => {
110109 filteredServices
111110 ] )
112111
113- useInterval ( async ( ) => {
112+ const getData = async ( ) => {
114113 const logs = await getLogs ( runtimePid )
115114 setApplicationLogs ( logs )
116- } , REFRESH_INTERVAL_LOGS )
115+ }
116+
117+ useInterval ( ( ) => { getData ( ) } , REFRESH_INTERVAL_LOGS )
118+ useEffect ( ( ) => { getData ( ) } , [ runtimePid ] )
117119
118120 useEffect ( ( ) => {
119121 if ( scrollDirection !== DIRECTION_TAIL && filteredLogsLengthAtPause > 0 && filteredLogsLengthAtPause < filteredLogs . length ) {
@@ -127,13 +129,6 @@ const AppLogs = React.forwardRef(({ filteredServices }, ref) => {
127129 setFilteredLogsLengthAtPause ( 0 )
128130 }
129131
130- async function loadPreviousLogs ( ) {
131- }
132-
133- /* function onlyUnique (value, index, array) {
134- return array.indexOf(value) === index
135- } */
136-
137132 function saveLogs ( ) {
138133 let fileData = ''
139134 applicationLogs . forEach ( log => {
@@ -168,7 +163,6 @@ const AppLogs = React.forwardRef(({ filteredServices }, ref) => {
168163 }
169164
170165 function handleScroll ( event ) {
171- // setStatusPausedLogs(STATUS_PAUSED_LOGS)
172166 const st = event . currentTarget . scrollTop // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
173167 if ( st > lastScrollTop ) {
174168 // downscroll code
@@ -219,12 +213,6 @@ const AppLogs = React.forwardRef(({ filteredServices }, ref) => {
219213 </ div >
220214 < HorizontalSeparator marginBottom = { MARGIN_0 } color = { WHITE } opacity = { OPACITY_15 } />
221215 < div className = { `${ styles . logsContainer } ${ styles . lateralPadding } ` } ref = { logContentRef } onScroll = { handleScroll } >
222- { showPreviousLogs && (
223- < div className = { styles . previousLogContainer } >
224- < p className = { `${ typographyStyles . desktopBodySmall } ${ typographyStyles . textWhite } ${ typographyStyles . textCenter } ${ commonStyles . fullWidth } ` } > < span className = { `${ commonStyles . cursorPointer } ${ typographyStyles . textTertiaryBlue } ` } onClick = { ( ) => loadPreviousLogs ( ) } > Click Here</ span > to load previous logs</ p >
225- </ div >
226- ) }
227-
228216 { filteredLogs ?. length > 0 && (
229217 < >
230218 < hr className = { styles . logDividerTop } />
0 commit comments