Skip to content

Commit

Permalink
Fix [Jobs] log is being duplicated upon refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
mavdryk committed Jan 9, 2024
1 parent 661475b commit f01a60a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/DetailsLogs/DetailsLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ const DetailsLogs = ({
}, [item, params.projectName, refreshLogs, removeLogs, withLogsRefreshBtn])

const handleScroll = event => {
if (streamLogsRef.current && event.target.scrollHeight - event.target.scrollTop === event.target.clientHeight) {
if (
streamLogsRef.current &&
event.target.scrollHeight - event.target.scrollTop - 1 < event.target.clientHeight
) {
streamLogsRef.current()
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils/getJobLogs.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
export const getJobLogs = (uid, projectName, streamLogsRef, setDetailsLogs, fetchJobLogs) => {
setDetailsLogs('')

fetchJobLogs(uid, projectName).then(res => {
const reader = res.body?.getReader()

Expand Down

0 comments on commit f01a60a

Please sign in to comment.