@@ -936,6 +936,54 @@ describe('useChartConfig', () => {
936936 expect ( result . current . error ) . toBe ( mockError ) ;
937937 } ) ;
938938
939+ it ( 'has an error status with partial data after the second chunk fails to fetch' , async ( ) => {
940+ const mockError = new Error ( 'Query failed' ) ;
941+ const mockSuccess = createMockQueryResponse ( [
942+ {
943+ 'count()' : '71' ,
944+ __hdx_time_bucket : '2025-10-01T18:00:00Z' ,
945+ } ,
946+ ] ) ;
947+
948+ mockClickhouseClient . queryChartConfig
949+ . mockResolvedValueOnce ( mockSuccess )
950+ . mockRejectedValueOnce ( mockError ) ;
951+
952+ const onError = jest . fn ( ) ;
953+ const config = createMockChartConfig ( {
954+ dateRange : [
955+ new Date ( '2025-10-01 00:00:00Z' ) ,
956+ new Date ( '2025-10-02 00:00:00Z' ) ,
957+ ] ,
958+ granularity : '3 hour' ,
959+ } ) ;
960+
961+ const { result } = renderHook (
962+ ( ) =>
963+ useQueriedChartConfig ( config , {
964+ onError,
965+ retry : false ,
966+ enableQueryChunking : true ,
967+ } ) ,
968+ {
969+ wrapper,
970+ } ,
971+ ) ;
972+
973+ await waitFor ( ( ) => expect ( result . current . isError ) . toBe ( true ) ) ;
974+ expect ( result . current . isFetching ) . toBe ( false ) ;
975+ expect ( result . current . isSuccess ) . toBe ( false ) ;
976+
977+ expect ( result . current . error ) . toBe ( mockError ) ;
978+ expect ( onError ) . toHaveBeenCalledWith ( mockError ) ;
979+ expect ( result . current . data ) . toEqual ( {
980+ data : mockSuccess . data ,
981+ meta : mockSuccess . meta ,
982+ rows : mockSuccess . rows ,
983+ isComplete : false ,
984+ } ) ;
985+ } ) ;
986+
939987 it ( 'does not make requests if it is disabled' , async ( ) => {
940988 const config = createMockChartConfig ( {
941989 dateRange : [
0 commit comments