Skip to content

Commit

Permalink
fix: virtuosoitem height zero issue
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Sep 9, 2024
1 parent 6758793 commit 3c5c7ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/renderer/src/components/ui/placeholder.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const ReactVirtuosoItemPlaceholder = () => (
// NOTE: prevent 0 height element, react virtuoso will not stop render any more
<div className="h-[0.0000001px]" />
<div className="h-[0.5px] shrink-0" />
)
6 changes: 4 additions & 2 deletions src/renderer/src/modules/entry-column/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import { FeedNotFound } from "@renderer/components/errors/FeedNotFound"
import { AutoResizeHeight } from "@renderer/components/ui/auto-resize-height"
import { Button } from "@renderer/components/ui/button"
import { LoadingCircle } from "@renderer/components/ui/loading"
import { ReactVirtuosoItemPlaceholder } from "@renderer/components/ui/placeholder"
import { ScrollArea } from "@renderer/components/ui/scroll-area"
import { FEED_COLLECTION_LIST, ROUTE_FEED_PENDING, views } from "@renderer/constants"
import { useNavigateEntry } from "@renderer/hooks/biz/useNavigateEntry"
import { useRouteParamsSelector, useRouteParms } from "@renderer/hooks/biz/useRouteParams"
import { useTitle } from "@renderer/hooks/common"
import { useTypeScriptHappyCallback } from "@renderer/hooks/common/useTypescriptHappyCallback"
import { FeedViewType } from "@renderer/lib/enum"
import { cn, isBizId } from "@renderer/lib/utils"
import { useFeed } from "@renderer/queries/feed"
Expand Down Expand Up @@ -147,9 +149,9 @@ export function EntryColumn() {
isInteracted.current = true
}
},
itemContent: useCallback(
itemContent: useTypeScriptHappyCallback(
(_, entryId) => {
if (!entryId) return null
if (!entryId) return <ReactVirtuosoItemPlaceholder />

return <EntryItem key={entryId} entryId={entryId} view={view} />
},
Expand Down

0 comments on commit 3c5c7ba

Please sign in to comment.