Fix freezing when navigating back to main timeline

This commit is contained in:
hzrd149
2023-09-24 11:19:37 -05:00
parent 6276c4739e
commit 20fb8fb94e
9 changed files with 128 additions and 39 deletions

View File

@@ -46,9 +46,17 @@ export type NoteProps = Omit<CardProps, "children"> & {
variant?: CardProps["variant"];
showReplyButton?: boolean;
hideDrawerButton?: boolean;
registerIntersectionEntity?: boolean;
};
export const Note = React.memo(
({ event, variant = "outline", showReplyButton, hideDrawerButton, ...props }: NoteProps) => {
({
event,
variant = "outline",
showReplyButton,
hideDrawerButton,
registerIntersectionEntity = true,
...props
}: NoteProps) => {
const account = useCurrentAccount();
const { showReactions, showSignatureVerification } = useSubject(appSettings);
const replyForm = useDisclosure();
@@ -67,7 +75,12 @@ export const Note = React.memo(
return (
<TrustProvider event={event}>
<ExpandProvider>
<Card variant={variant} ref={ref} data-event-id={event.id} {...props}>
<Card
variant={variant}
ref={registerIntersectionEntity ? ref : undefined}
data-event-id={event.id}
{...props}
>
<CardHeader padding="2">
<Flex flex="1" gap="2" alignItems="center">
<UserAvatarLink pubkey={event.pubkey} size={["xs", "sm"]} />