@@ -7,6 +7,7 @@ import { useEffect, useState } from "react";
77import {
88 CrossChainIndexingStatusSnapshot ,
99 createRealtimeIndexingStatusProjection ,
10+ EnsApiIndexingStatusResponseOk ,
1011 IndexingStatusResponseCodes ,
1112 IndexingStatusResponseOk ,
1213 OmnichainIndexingStatusIds ,
@@ -37,7 +38,7 @@ let loadingTimeoutId: number;
3738
3839async function fetchMockedIndexingStatus (
3940 selectedVariant : Variant ,
40- ) : Promise < CrossChainIndexingStatusSnapshot > {
41+ ) : Promise < EnsApiIndexingStatusResponseOk > {
4142 // always try clearing loading timeout when performing a mocked fetch
4243 // this way we get a fresh and very long request to observe the loading state
4344 if ( loadingTimeoutId ) {
@@ -53,14 +54,14 @@ async function fetchMockedIndexingStatus(
5354 selectedVariant
5455 ] as IndexingStatusResponseOk ;
5556
56- return response . realtimeProjection . snapshot ;
57+ return response ;
5758 }
5859 case "Error ResponseCode" :
5960 throw new Error (
6061 "Received Indexing Status response with responseCode other than 'ok' which will not be cached." ,
6162 ) ;
6263 case "Loading" :
63- return new Promise < CrossChainIndexingStatusSnapshot > ( ( _resolve , reject ) => {
64+ return new Promise < EnsApiIndexingStatusResponseOk > ( ( _resolve , reject ) => {
6465 loadingTimeoutId = + setTimeout ( reject , 5 * 60 * 1_000 ) ;
6566 } ) ;
6667 case "Loading Error" :
@@ -77,10 +78,14 @@ export default function MockIndexingStatusPage() {
7778 const mockedIndexingStatus = useQuery ( {
7879 queryKey : [ "mock" , "useIndexingStatus" , selectedVariant ] ,
7980 queryFn : ( ) => fetchMockedIndexingStatus ( selectedVariant ) ,
80- select : ( cachedSnapshot ) => {
81+ select : ( response ) => {
8182 return {
8283 responseCode : IndexingStatusResponseCodes . Ok ,
83- realtimeProjection : createRealtimeIndexingStatusProjection ( cachedSnapshot , now ) ,
84+ realtimeProjection : createRealtimeIndexingStatusProjection (
85+ response . realtimeProjection . snapshot ,
86+ now ,
87+ ) ,
88+ config : response . config ,
8489 } satisfies IndexingStatusResponseOk ;
8590 } ,
8691 retry : false , // allows loading error to be observed immediately
0 commit comments