mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: don't show ellipses on search when query is in-flight (#723)
This commit is contained in:
parent
5a10ae1d47
commit
6864836329
2 changed files with 26 additions and 14 deletions
5
.changeset/honest-steaks-allow.md
Normal file
5
.changeset/honest-steaks-allow.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@hyperdx/app": patch
|
||||
---
|
||||
|
||||
fix: don't show ellipses on search when query is in-flight
|
||||
|
|
@ -132,26 +132,33 @@ function SearchTotalCount({
|
|||
granularity,
|
||||
limit: { limit: 100000 },
|
||||
};
|
||||
const {
|
||||
data: totalCountData,
|
||||
isLoading,
|
||||
isError,
|
||||
} = useQueriedChartConfig(queriedConfig, {
|
||||
queryKey: [queryKeyPrefix, queriedConfig],
|
||||
staleTime: 1000 * 60 * 5,
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
const { data: totalCountData, isError } = useQueriedChartConfig(
|
||||
queriedConfig,
|
||||
{
|
||||
queryKey: [queryKeyPrefix, queriedConfig],
|
||||
staleTime: 1000 * 60 * 5,
|
||||
refetchOnWindowFocus: false,
|
||||
},
|
||||
);
|
||||
|
||||
const totalCount = useMemo(() => {
|
||||
return totalCountData?.data?.reduce(
|
||||
(p: number, v: any) => p + Number.parseInt(v['count()']),
|
||||
0,
|
||||
const [totalCount, setTotalCount] = useState<number | null>(null);
|
||||
useEffect(() => {
|
||||
if (!totalCountData) {
|
||||
// if totalCount already exists, set to that. Else, set to null
|
||||
setTotalCount(totalCount ?? null);
|
||||
return;
|
||||
}
|
||||
setTotalCount(
|
||||
totalCountData?.data?.reduce(
|
||||
(p: number, v: any) => p + Number.parseInt(v['count()']),
|
||||
0,
|
||||
),
|
||||
);
|
||||
}, [totalCountData]);
|
||||
|
||||
return (
|
||||
<Text size="xs" c="gray.4" mb={4}>
|
||||
{isLoading ? (
|
||||
{!totalCount ? (
|
||||
<span className="effect-pulse">··· Results</span>
|
||||
) : totalCount !== null && !isError ? (
|
||||
`${totalCount} Results`
|
||||
|
|
|
|||
Loading…
Reference in a new issue