Skip to content

Commit

Permalink
fix(analytics): only show metric cards if apps are present [MA-3030] (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adorack authored Aug 2, 2024
1 parent 5097552 commit 987d0ed
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/views/MyApps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
class="no-auth-strategies-warning"
data-testid="no-auth-strategies-warning"
/>
<AnalyticsConfigCheck require-analytics>
<AnalyticsConfigCheck
v-if="!myAppsReady || appsArePresent"
require-analytics
>
<div>
<MetricsProvider
v-slot="{ timeframe }"
Expand Down Expand Up @@ -268,7 +271,7 @@ export default defineComponent({
}
const modalTitle = computed(() => `Delete ${deleteItem.value?.name}`)
const appIds = ref([])
const appIds = ref<string[] | null>(null)
const { state: currentState, send } = useMachine(createMachine({
predictableActionArguments: true,
Expand Down Expand Up @@ -375,10 +378,14 @@ export default defineComponent({
return helpTextVitals.summary
}
const myAppsReady = computed(() => Boolean(appIds.value && appIds.value?.length))
// Show the metric cards if applications are loading or if applications have loaded and exist.
// If we try to show metric cards when there aren't any applications, they won't be able to
// issue a query and will just show an endless skeleton loader.
const myAppsReady = computed(() => appIds.value !== null)
const appsArePresent = computed(() => !!appIds.value?.length)
const metricProviderProps = computed(() => ({
queryReady: myAppsReady.value,
queryReady: appsArePresent.value,
additionalFilter: [
{
type: EXPLORE_V2_FILTER_TYPES.IN,
Expand Down Expand Up @@ -431,7 +438,9 @@ export default defineComponent({
helpText,
helpTextVitals,
analyticsCardTitle,
metricProviderProps
metricProviderProps,
myAppsReady,
appsArePresent
}
}
})
Expand Down

0 comments on commit 987d0ed

Please sign in to comment.