File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -75,12 +75,12 @@ export const useLogStore = defineStore('logreader-logs', () => {
7575 }
7676
7777 try {
78- if ( older ) {
78+ if ( older || ! allEntries . value . length ) {
7979 const { data } = await getLog ( { offset : allEntries . value . length , query : query . value } )
8080 allEntries . value . push ( ...data . data . map ( parseRawLogEntry ) )
8181 hasRemainingEntries . value = data . remain
8282 } else {
83- const { data } = await pollLog ( { lastReqId : allEntries . value [ 0 ] ? .reqId || '' } )
83+ const { data } = await pollLog ( { lastReqId : allEntries . value [ 0 ] ! . reqId } )
8484 allEntries . value . splice ( 0 , 0 , ...data . map ( parseRawLogEntry ) )
8585 }
8686 } catch ( e ) {
@@ -147,9 +147,9 @@ export const useLogStore = defineStore('logreader-logs', () => {
147147
148148 const doPolling = async ( ) => {
149149 try {
150- // Only poll if not using a local file
151- if ( _settings . isEnabled && query . value === '' ) {
152- const { data } = await pollLog ( { lastReqId : allEntries . value [ 0 ] ? .reqId || '' } )
150+ // Only poll if not using a local file and store already has some known entries
151+ if ( _settings . isEnabled && query . value === '' && allEntries . value . length ) {
152+ const { data } = await pollLog ( { lastReqId : allEntries . value [ 0 ] ! . reqId } )
153153 allEntries . value . splice ( 0 , 0 , ...data . map ( parseRawLogEntry ) )
154154 }
155155 } catch ( e ) {
You can’t perform that action at this time.
0 commit comments