Skip to content

Commit

Permalink
fix: grouped list data item render
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Aug 6, 2024
1 parent 767710d commit da486bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/renderer/src/modules/entry-column/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const ListHeader: FC<{
</>
)}
{isOnline ? (
feed?.ownerUserId === user?.id && isBizId(routerParams.feedId) ?
feed?.ownerUserId === user?.id && isBizId(routerParams.feedId!) ?
(
<ActionButton
tooltip="Refresh"
Expand Down
24 changes: 10 additions & 14 deletions src/renderer/src/modules/entry-column/lists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import { useEntry } from "@renderer/store/entry"
import type { HTMLMotionProps } from "framer-motion"
import type { DOMAttributes, FC } from "react"
import { forwardRef, memo, useCallback } from "react"
import type {
VirtuosoHandle,
VirtuosoProps,
} from "react-virtuoso"
import type { VirtuosoHandle, VirtuosoProps } from "react-virtuoso"
import { GroupedVirtuoso, Virtuoso } from "react-virtuoso"

import { DateItem } from "./date-item"
Expand Down Expand Up @@ -107,7 +104,8 @@ const EntryGroupedList = forwardRef<
groupCounts,
itemContent,
onKeyDown,

data,
totalCount,
...virtuosoOptions
},
ref,
Expand All @@ -116,23 +114,21 @@ const EntryGroupedList = forwardRef<
ref={ref}
groupContent={useCallback(
(index: number) => {
const entryId = getGetGroupDataIndex(
groupCounts!,
index,
virtuosoOptions.data!,
)
const entryId = getGetGroupDataIndex(groupCounts!, index, data!)

return <EntryHeadDateItem entryId={entryId} />
},
[groupCounts, virtuosoOptions.data],
[groupCounts, data],
)}
groupCounts={groupCounts}
onKeyDown={onKeyDown}
{...virtuosoOptions}
itemContent={useCallback(
(index: number, _: number, entryId: string, c: any) =>
itemContent?.(index, entryId, c),
[itemContent],
(index: number, _: number, __: string, c: any) => {
const entryId = data![index]
return itemContent?.(index, entryId, c)
},
[itemContent, JSON.stringify(data)],
)}
/>
),
Expand Down

0 comments on commit da486bc

Please sign in to comment.