Skip to content

Commit 3cd56a0

Browse files
SingTheCodeclaude
andcommitted
refactor: Extract sentinel row logic and clean up comments
- Extract repeated sentinel row condition into isSentinelRow helper function in Summary component - Remove Korean comment from Author component for code consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 476f139 commit 3cd56a0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/view/src/components/Common/Author/Author.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const StaticAvatar = ({ name, src }: AuthorInfo) => {
4141
};
4242

4343
const AvatarComponent = ({ name, src }: AuthorInfo) => {
44-
// src가 undefined인 경우 이름의 첫 글자를 표시하는 기본 아바타 사용
4544
if (!src) {
4645
return (
4746
<Avatar

packages/view/src/components/VerticalClusterList/Summary/Summary.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const Summary = ({ onLoadMore, isLoadingMore, enabled, isLastPage }: SummaryProp
6161

6262
// Infinite scroll: Observe sentinel when it's rendered
6363
const handleRowsRendered = ({ stopIndex }: { startIndex: number; stopIndex: number }) => {
64-
if (!isLastPage && stopIndex >= clusters.length && sentinelRef.current && enabled && observerRef.current) {
64+
if (isSentinelRow(stopIndex) && sentinelRef.current && enabled && observerRef.current) {
6565
if (!isObservingRef.current) {
6666
observerRef.current.observe(sentinelRef.current);
6767
isObservingRef.current = true;
@@ -77,13 +77,15 @@ const Summary = ({ onLoadMore, isLoadingMore, enabled, isLastPage }: SummaryProp
7777
}
7878
}, [isLastPage]);
7979

80+
const isSentinelRow = (index: number) => !isLastPage && index === clusters.length;
81+
8082
const onClickClusterSummary = (clusterId: number) => () => {
8183
const selected = getClusterById(filteredData, clusterId);
8284
toggleSelectedData(selected, clusterId);
8385
};
8486

8587
const getRowHeight = ({ index }: { index: number }) => {
86-
if (!isLastPage && index === clusters.length) {
88+
if (isSentinelRow(index)) {
8789
return 10;
8890
}
8991

@@ -93,7 +95,7 @@ const Summary = ({ onLoadMore, isLoadingMore, enabled, isLastPage }: SummaryProp
9395

9496
const rowRenderer = (props: ListRowProps) => {
9597
// Render sentinel element
96-
if (!isLastPage && props.index === clusters.length) {
98+
if (isSentinelRow(props.index)) {
9799
return (
98100
<div
99101
ref={sentinelRef}

0 commit comments

Comments
 (0)