Skip to content

Commit 5773fc9

Browse files
authored
fix: data display exceptions during initialization (#1531)
1 parent 1a97db0 commit 5773fc9

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

packages/kami-design/components/Overlay/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ interface OverLayProps {
1818
darkness?: number
1919
blur?: boolean
2020
zIndex?: number
21+
stopPropagation?: boolean
2122
}
2223

2324
export type OverlayProps = OverLayProps & {
2425
show: boolean
2526
children?: ReactNode
26-
2727
zIndex?: number
28-
2928
standaloneWrapperClassName?: string
3029
}
3130

@@ -35,10 +34,10 @@ const OverLay: FC<OverlayProps> = (props) => {
3534
show,
3635
blur,
3736
center,
38-
3937
darkness,
4038
standaloneWrapperClassName,
4139
zIndex,
40+
stopPropagation,
4241
} = props
4342
const isClient = useIsClient()
4443

@@ -108,7 +107,12 @@ const OverLay: FC<OverlayProps> = (props) => {
108107
: undefined
109108
}
110109
>
111-
<div onClick={stopEventDefault} tabIndex={-1}>
110+
<div
111+
onClick={(e) => {
112+
stopPropagation ? e.stopPropagation() : stopEventDefault(e)
113+
}}
114+
tabIndex={-1}
115+
>
112116
{props.children}
113117
</div>
114118
</div>

src/components/in-page/Home/section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const _Sections: FC<AggregateTop> = ({ notes, posts }) => {
110110
}, [])}
111111
/>
112112
<SectionCard
113-
title={`点赞 (${like})`}
113+
title={`点赞 (${like ?? 0})`}
114114
desc={'如果你喜欢的话点个赞呗'}
115115
src={useMemo(() => getRandomUnRepeatImage(), [])}
116116
href={'/like_this'}

src/pages/recently/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const RecentlyPage: NextPage = () => {
138138
}
139139

140140
if (inView && hasNext) {
141-
setFetchBefore(data[data.length - 1].id)
141+
setFetchBefore(data[data.length - 1]?.id)
142142
}
143143
}, [data, hasNext, inView, loading])
144144

@@ -161,6 +161,9 @@ const RecentlyPage: NextPage = () => {
161161
fixedWidth: true,
162162
useRootPortal: true,
163163
},
164+
overlayProps: {
165+
stopPropagation: true,
166+
},
164167
component: (
165168
<>
166169
<p className="!mt-4 leading-6 whitespace-pre-line break-all">

0 commit comments

Comments
 (0)