@@ -23,7 +23,7 @@ function Probe() {
2323 const sync = useTriggerSync ( )
2424 return (
2525 < div >
26- < span > { result . data ?. [ 0 ] ?. viewerDocumentCount ?? 0 } </ span >
26+ < span > { String ( result . data ?. [ 0 ] ?. hasViewerDocuments ?? false ) } </ span >
2727 < button
2828 disabled = { sync . isPending }
2929 onClick = { ( ) => sync . mutate ( { knowledgeBaseId : 'kb' , connectorId : 'source' } ) }
@@ -83,7 +83,7 @@ beforeEach(() => {
8383 isSyncing : syncing ,
8484 hasSyncError : false ,
8585 viewerFailedDocumentCount : 0 ,
86- viewerDocumentCount : syncing ? 0 : 1 ,
86+ hasViewerDocuments : ! syncing ,
8787 } ,
8888 ] ,
8989 nextCursor : null ,
@@ -127,7 +127,7 @@ describe('source progress polling', () => {
127127 await advance ( 1 )
128128 expect (
129129 client . getQueryData ( searchSourceKeys . pages ( 'workspace' , { search : '' , mine : false } ) )
130- ) . toMatchObject ( { pages : [ { sources : [ { isSyncing : false , viewerDocumentCount : 1 } ] } ] } )
130+ ) . toMatchObject ( { pages : [ { sources : [ { isSyncing : false , hasViewerDocuments : true } ] } ] } )
131131 const total = mocks . requestJson . mock . calls . length
132132 await advance ( 60_000 )
133133 expect ( mocks . requestJson ) . toHaveBeenCalledTimes ( total )
@@ -157,7 +157,9 @@ describe('source progress polling', () => {
157157 expect (
158158 client . getQueryData ( searchSourceKeys . pages ( 'workspace' , { search : '' , mine : false } ) )
159159 ) . toMatchObject ( {
160- pages : [ { sources : [ expect . objectContaining ( { isSyncing : false , viewerDocumentCount : 1 } ) ] } ] ,
160+ pages : [
161+ { sources : [ expect . objectContaining ( { isSyncing : false , hasViewerDocuments : true } ) ] } ,
162+ ] ,
161163 } )
162164 const total = mocks . requestJson . mock . calls . length
163165 await advance ( 60_000 )
@@ -173,7 +175,9 @@ describe('source progress polling', () => {
173175 expect (
174176 client . getQueryData ( searchSourceKeys . pages ( 'workspace' , { search : '' , mine : false } ) )
175177 ) . toMatchObject ( {
176- pages : [ { sources : [ expect . objectContaining ( { isSyncing : false , viewerDocumentCount : 1 } ) ] } ] ,
178+ pages : [
179+ { sources : [ expect . objectContaining ( { isSyncing : false , hasViewerDocuments : true } ) ] } ,
180+ ] ,
177181 } )
178182 } )
179183 it ( 'lets a slow summary refresh finish while progress keeps polling' , async ( ) => {
@@ -201,7 +205,9 @@ describe('source progress polling', () => {
201205 expect (
202206 client . getQueryData ( searchSourceKeys . pages ( 'workspace' , { search : '' , mine : false } ) )
203207 ) . toMatchObject ( {
204- pages : [ { sources : [ expect . objectContaining ( { isSyncing : false , viewerDocumentCount : 1 } ) ] } ] ,
208+ pages : [
209+ { sources : [ expect . objectContaining ( { isSyncing : false , hasViewerDocuments : true } ) ] } ,
210+ ] ,
205211 } )
206212 const total = mocks . requestJson . mock . calls . length
207213 await advance ( 60_000 )
0 commit comments