Skip to content

Commit

Permalink
perf: memo entry column to reduce resize panel re-render
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 10, 2024
1 parent 24b768a commit 6bca4b4
Showing 1 changed file with 4 additions and 2 deletions.
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 @@ -19,7 +19,7 @@ import { useFeed } from "@renderer/queries/feed"
import { entryActions, useEntry } from "@renderer/store/entry"
import { useFeedByIdSelector } from "@renderer/store/feed"
import { useSubscriptionByFeedId } from "@renderer/store/subscription"
import { useCallback, useEffect, useRef, useState } from "react"
import { memo, useCallback, useEffect, useRef, useState } from "react"
import type {
ScrollSeekConfiguration,
VirtuosoGridProps,
Expand All @@ -39,7 +39,7 @@ const scrollSeekConfiguration: ScrollSeekConfiguration = {
enter: (velocity) => Math.abs(velocity) > 1000,
exit: (velocity) => Math.abs(velocity) < 1000,
}
export function EntryColumn() {
function EntryColumnImpl() {
const virtuosoRef = useRef<VirtuosoHandle>(null)
const [isArchived, setIsArchived] = useState(false)
const unreadOnly = useGeneralSettingKey("unreadOnly")
Expand Down Expand Up @@ -280,3 +280,5 @@ const AddFeedHelper = () => {

throw new FeedFoundCanBeFollowError(feedQuery.data.feed)
}

export const EntryColumn = memo(EntryColumnImpl)

0 comments on commit 6bca4b4

Please sign in to comment.