File tree Expand file tree Collapse file tree 2 files changed +204
-193
lines changed
apps/sim/app/workspace/[workspaceId]/logs Expand file tree Collapse file tree 2 files changed +204
-193
lines changed Original file line number Diff line number Diff line change @@ -289,9 +289,19 @@ export default function Dashboard({
289289
290290 const executions = metricsQuery . data ?. workflows ?? [ ]
291291 const aggregateSegments = metricsQuery . data ?. aggregateSegments ?? [ ]
292- const loading = metricsQuery . isLoading
293292 const error = metricsQuery . error ?. message ?? null
294293
294+ /**
295+ * Loading state logic using TanStack Query best practices:
296+ * - isPending: true when there's no cached data (initial load only)
297+ * - isFetching: true when any fetch is in progress
298+ * - isPlaceholderData: true when showing stale data from keepPreviousData
299+ *
300+ * We only show skeleton on initial load (isPending + no data).
301+ * For subsequent fetches, keepPreviousData shows stale content while fetching.
302+ */
303+ const showSkeleton = metricsQuery . isPending && ! metricsQuery . data
304+
295305 // Check if any filters are actually applied
296306 const hasActiveFilters = useMemo (
297307 ( ) =>
@@ -747,7 +757,7 @@ export default function Dashboard({
747757 }
748758 } , [ refreshTrigger ] )
749759
750- if ( loading ) {
760+ if ( showSkeleton ) {
751761 return < DashboardSkeleton />
752762 }
753763
You can’t perform that action at this time.
0 commit comments