fix: summary remained same when switching to adjacent elements

This commit is contained in:
Apoorv Mishra committed 2023-07-21 16:50:13 +05:30
1 parent 5f67fa7895
commit 233edf88ec
2 files changed
+2 -5

No files matched your search

-1
View File
@@ -349,7 +349,6 @@ function Editor(props: Props, ref: React.RefObject<SharedEditor> | null) {
)}
{activeLinkElement && !shareId && (
<HoverPreview
id={props.id}
element={activeLinkElement}
onClose={handleLinkInactive}
/>
+2 -4
View File
@@ -19,15 +19,13 @@ const CARD_PADDING = 16;
const CARD_MAX_WIDTH = 375;
type Props = {
/* The document associated with the editor, if any */
id?: string;
/* The HTML element that is being hovered over */
element: HTMLAnchorElement;
/* A callback on close of the hover preview */
onClose: () => void;
};
function HoverPreviewInternal({ element, id, onClose }: Props) {
function HoverPreviewInternal({ element, onClose }: Props) {
const url = element.href || element.dataset.url;
const [isVisible, setVisible] = React.useState(false);
const timerClose = React.useRef<ReturnType<typeof setTimeout>>();
@@ -143,7 +141,7 @@ function HoverPreviewInternal({ element, id, onClose }: Props) {
/>
) : data.type === UnfurlType.Document ? (
<HoverPreviewDocument
id={id}
id={data.meta.id}
url={data.url}
title={data.title}
description={data.description}