Skip to content

Commit

Permalink
fix: data display exceptions during initialization (#1531)
Browse files Browse the repository at this point in the history
  • Loading branch information
suemor233 authored Jan 9, 2023
1 parent 1a97db0 commit 5773fc9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
12 changes: 8 additions & 4 deletions packages/kami-design/components/Overlay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ interface OverLayProps {
darkness?: number
blur?: boolean
zIndex?: number
stopPropagation?: boolean
}

export type OverlayProps = OverLayProps & {
show: boolean
children?: ReactNode

zIndex?: number

standaloneWrapperClassName?: string
}

Expand All @@ -35,10 +34,10 @@ const OverLay: FC<OverlayProps> = (props) => {
show,
blur,
center,

darkness,
standaloneWrapperClassName,
zIndex,
stopPropagation,
} = props
const isClient = useIsClient()

Expand Down Expand Up @@ -108,7 +107,12 @@ const OverLay: FC<OverlayProps> = (props) => {
: undefined
}
>
<div onClick={stopEventDefault} tabIndex={-1}>
<div
onClick={(e) => {
stopPropagation ? e.stopPropagation() : stopEventDefault(e)
}}
tabIndex={-1}
>
{props.children}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/in-page/Home/section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const _Sections: FC<AggregateTop> = ({ notes, posts }) => {
}, [])}
/>
<SectionCard
title={`点赞 (${like})`}
title={`点赞 (${like ?? 0})`}
desc={'如果你喜欢的话点个赞呗'}
src={useMemo(() => getRandomUnRepeatImage(), [])}
href={'/like_this'}
Expand Down
5 changes: 4 additions & 1 deletion src/pages/recently/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const RecentlyPage: NextPage = () => {
}

if (inView && hasNext) {
setFetchBefore(data[data.length - 1].id)
setFetchBefore(data[data.length - 1]?.id)
}
}, [data, hasNext, inView, loading])

Expand All @@ -161,6 +161,9 @@ const RecentlyPage: NextPage = () => {
fixedWidth: true,
useRootPortal: true,
},
overlayProps: {
stopPropagation: true,
},
component: (
<>
<p className="!mt-4 leading-6 whitespace-pre-line break-all">
Expand Down

0 comments on commit 5773fc9

Please sign in to comment.