Skip to content

Commit 33fa4ba

Browse files
committed
fix: search panel loading spinner bug
Signed-off-by: Innei <[email protected]>
1 parent 8844c36 commit 33fa4ba

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/components/modules/shared/SearchFAB.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ const SearchPanelImpl = () => {
217217
)
218218

219219
const isLogged = useIsLogged()
220+
220221
return (
221222
<m.div
222223
className={clsx(
@@ -266,9 +267,9 @@ const SearchPanelImpl = () => {
266267
<div className="flex flex-col items-center space-y-2">
267268
{!keyword ? (
268269
<i className="icon-[mingcute--search-line] text-[60px]" />
269-
) : !isLoading ? (
270+
) : (
270271
<EmptyIcon />
271-
) : null}
272+
)}
272273

273274
{!data && isLoading && isFetching && (
274275
<div className="loading-dots text-[30px]" />
@@ -281,6 +282,12 @@ const SearchPanelImpl = () => {
281282
return <SearchItem key={item.id} {...item} index={index} />
282283
})
283284
)}
285+
286+
{data.length === 0 && isLoading && (
287+
<div className="flex h-full flex-grow center">
288+
<div className="loading loading-spinner" />
289+
</div>
290+
)}
284291
</ul>
285292
</div>
286293

src/hooks/common/use-input-composition.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useCallback, useRef } from 'react'
22
import type { CompositionEventHandler } from 'react'
33

44
export const useInputComposition = (
5-
props:
5+
props: Pick<
66
| React.DetailedHTMLProps<
77
React.InputHTMLAttributes<HTMLInputElement>,
88
HTMLInputElement
@@ -11,6 +11,8 @@ export const useInputComposition = (
1111
React.TextareaHTMLAttributes<HTMLTextAreaElement>,
1212
HTMLTextAreaElement
1313
>,
14+
'onKeyDown' | 'onCompositionEnd' | 'onCompositionStart'
15+
>,
1416
) => {
1517
const { onKeyDown, onCompositionStart, onCompositionEnd } = props
1618

0 commit comments

Comments
 (0)