@@ -253,25 +253,33 @@ const UnusedSchemaExplorer_UnusedSchemaQuery = graphql(`
253253 }
254254` ) ;
255255
256- function UnusedSchemaExplorer ( props : {
256+ function UnusedSchemaExplorer ( {
257+ dataRetentionInDays,
258+ hasCollectedOperations,
259+ organizationSlug,
260+ projectSlug,
261+ targetSlug,
262+ } : {
257263 dataRetentionInDays : number ;
264+ hasCollectedOperations : boolean ;
258265 organizationSlug : string ;
259266 projectSlug : string ;
260267 targetSlug : string ;
261268} ) {
262269 const dateRangeController = useDateRangeController ( {
263- dataRetentionInDays : props . dataRetentionInDays ,
270+ dataRetentionInDays,
264271 defaultPreset : presetLast7Days ,
265272 } ) ;
266273
267274 const [ query , refresh ] = useQuery ( {
268275 query : UnusedSchemaExplorer_UnusedSchemaQuery ,
269276 variables : {
270- organizationSlug : props . organizationSlug ,
271- projectSlug : props . projectSlug ,
272- targetSlug : props . targetSlug ,
277+ organizationSlug,
278+ projectSlug,
279+ targetSlug,
273280 period : dateRangeController . resolvedRange ,
274281 } ,
282+ pause : ! hasCollectedOperations ,
275283 } ) ;
276284
277285 useEffect ( ( ) => {
@@ -283,7 +291,7 @@ function UnusedSchemaExplorer(props: {
283291 if ( query . error ) {
284292 return (
285293 < QueryError
286- organizationSlug = { props . organizationSlug }
294+ organizationSlug = { organizationSlug }
287295 error = { query . error }
288296 showLogoutButton = { false }
289297 />
@@ -311,14 +319,23 @@ function UnusedSchemaExplorer(props: {
311319 onUpdate = { args => dateRangeController . setSelectedPreset ( args . preset ) }
312320 />
313321 < SchemaVariantFilter
314- organizationSlug = { props . organizationSlug }
315- projectSlug = { props . projectSlug }
316- targetSlug = { props . targetSlug }
322+ organizationSlug = { organizationSlug }
323+ projectSlug = { projectSlug }
324+ targetSlug = { targetSlug }
317325 variant = "unused"
318326 />
319327 </ div >
320328 </ div >
321- { ! query . fetching && ! query . stale ? (
329+
330+ { ! hasCollectedOperations ? (
331+ < div className = "py-8" >
332+ < EmptyList
333+ title = "Hive is waiting for your first collected operation"
334+ description = "You can collect usage of your GraphQL API with Hive Client"
335+ docsUrl = "/features/usage-reporting"
336+ />
337+ </ div >
338+ ) : ! query . fetching && ! query . stale ? (
322339 < >
323340 { latestValidSchemaVersion ?. unusedSchema && latestSchemaVersion ? (
324341 < >
@@ -337,9 +354,9 @@ function UnusedSchemaExplorer(props: {
337354 < Link
338355 to = "/$organizationSlug/$projectSlug/$targetSlug/history/$versionId"
339356 params = { {
340- organizationSlug : props . organizationSlug ,
341- projectSlug : props . projectSlug ,
342- targetSlug : props . targetSlug ,
357+ organizationSlug,
358+ projectSlug,
359+ targetSlug,
343360 versionId : latestSchemaVersion . id ,
344361 } }
345362 >
@@ -351,9 +368,9 @@ function UnusedSchemaExplorer(props: {
351368 < UnusedSchemaView
352369 totalRequests = { query . data ?. target ?. operationsStats . totalRequests ?? 0 }
353370 explorer = { latestValidSchemaVersion . unusedSchema }
354- organizationSlug = { props . organizationSlug }
355- projectSlug = { props . projectSlug }
356- targetSlug = { props . targetSlug }
371+ organizationSlug = { organizationSlug }
372+ projectSlug = { projectSlug }
373+ targetSlug = { targetSlug }
357374 />
358375 </ >
359376 ) : (
@@ -426,21 +443,10 @@ function ExplorerUnusedSchemaPageContent(props: {
426443 return null ;
427444 }
428445
429- if ( ! hasCollectedOperations ) {
430- return (
431- < div className = "py-8" >
432- < EmptyList
433- title = "Hive is waiting for your first collected operation"
434- description = "You can collect usage of your GraphQL API with Hive Client"
435- docsUrl = "/features/usage-reporting"
436- />
437- </ div >
438- ) ;
439- }
440-
441446 return (
442447 < UnusedSchemaExplorer
443448 dataRetentionInDays = { currentOrganization . rateLimit . retentionInDays }
449+ hasCollectedOperations = { hasCollectedOperations }
444450 organizationSlug = { props . organizationSlug }
445451 projectSlug = { props . projectSlug }
446452 targetSlug = { props . targetSlug }
0 commit comments