Skip to content

Commit 09f37bd

Browse files
committed
fix: show loading only when keys are loading
1 parent 1d73608 commit 09f37bd

File tree

1 file changed

+9
-4
lines changed
  • src/components/databrowser/components/display

1 file changed

+9
-4
lines changed

src/components/databrowser/components/display/index.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
/* eslint-disable unicorn/no-negated-condition */
22
import { useDatabrowserStore } from "@/store"
33

4-
import { useKeyType } from "../../hooks/use-keys"
4+
import { useKeys, useKeyType } from "../../hooks/use-keys"
55
import { ListDisplay } from "./display-list"
66
import { EditorDisplay } from "./display-simple"
77

88
export const DataDisplay = () => {
99
const { selectedKey } = useDatabrowserStore()
10+
const { query } = useKeys()
1011
const type = useKeyType(selectedKey)
1112

1213
return (
1314
<div className="h-full rounded-xl border bg-white p-1">
1415
{!selectedKey ? (
1516
<div />
1617
) : !type ? (
17-
<div className="flex h-full items-center justify-center">
18-
<span className="text-gray-500">Loading...</span>
19-
</div>
18+
query.isLoading ? (
19+
<div className="flex h-full items-center justify-center">
20+
<span className="text-gray-500">Loading...</span>
21+
</div>
22+
) : (
23+
<div />
24+
)
2025
) : (
2126
<>
2227
{type === "string" || type === "json" ? (

0 commit comments

Comments
 (0)