@@ -109,8 +109,7 @@ function readLogFileIncremental(
109109 if ( currentSize < state . lastFileSize ) {
110110 logDebug ( 'File truncated, doing full read. Old size: %d, new size: %d' , state . lastFileSize , currentSize )
111111 const content = readFileSync ( path , "utf-8" )
112- // Filter empty lines to match incremental read behavior
113- const lines = content . split ( "\n" ) . filter ( line => line !== '' )
112+ const lines = content . split ( "\n" )
114113 state . lastFileSize = currentSize
115114 state . lastLineCount = lines . length
116115 return {
@@ -124,9 +123,8 @@ function readLogFileIncremental(
124123 // For small files, just do a full read (simpler and fast enough)
125124 if ( currentSize < INCREMENTAL_THRESHOLD_BYTES ) {
126125 const content = readFileSync ( path , "utf-8" )
127- // Filter empty lines to match incremental read behavior
128- const lines = content . split ( "\n" ) . filter ( line => line !== '' )
129- const newLinesCount = Math . max ( 0 , lines . length - state . lastLineCount )
126+ const lines = content . split ( "\n" )
127+ const newLinesCount = lines . length - state . lastLineCount
130128 state . lastFileSize = currentSize
131129 state . lastLineCount = lines . length
132130 return {
@@ -182,15 +180,14 @@ function readLogFileIncremental(
182180
183181/**
184182 * Read entire log file (used for initial load or after truncation)
185- * Filters empty lines to match incremental read behavior
186183 */
187184function readLogFileFull ( path : string ) : string [ ] {
188185 try {
189186 if ( ! existsSync ( path ) ) {
190187 return [ ]
191188 }
192189 const content = readFileSync ( path , "utf-8" )
193- return content . split ( "\n" ) . filter ( line => line !== '' )
190+ return content . split ( "\n" )
194191 } catch {
195192 return [ ]
196193 }
@@ -502,9 +499,8 @@ export function useLogStream(
502499 const currentFileSize = getFileSize ( logPath )
503500
504501 // Update incremental state
505- // IMPORTANT: Track RAW line count, not filtered, to match readLogFileIncremental
506502 incrementalState . lastFileSize = currentFileSize
507- incrementalState . lastLineCount = fileLines . length
503+ incrementalState . lastLineCount = filteredLines . length
508504
509505 // Update windowed state
510506 const trimCount = Math . max ( 0 , filteredLines . length - maxWindow )
0 commit comments