Middle Column / Pinned: Fix disappearing albums (#2943)
This commit is contained in:
parent
ae7662a152
commit
a2e21994d0
@ -49,13 +49,14 @@ export default function useMessageObservers(
|
||||
|
||||
const { dataset } = target as HTMLDivElement;
|
||||
const messageId = Number(dataset.lastMessageId || dataset.messageId);
|
||||
const albumMainId = dataset.albumMainId ? Number(dataset.albumMainId) : undefined;
|
||||
|
||||
if (!isIntersecting) {
|
||||
if (dataset.isPinned) {
|
||||
if (rootBounds && boundingClientRect.bottom < rootBounds.top) {
|
||||
isReversed = true;
|
||||
}
|
||||
viewportPinnedIdsToRemove.push(messageId);
|
||||
viewportPinnedIdsToRemove.push(albumMainId || messageId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -73,7 +74,7 @@ export default function useMessageObservers(
|
||||
}
|
||||
|
||||
if (dataset.isPinned) {
|
||||
viewportPinnedIdsToAdd.push(messageId);
|
||||
viewportPinnedIdsToAdd.push(albumMainId || messageId);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -413,7 +413,7 @@ const Message: FC<OwnProps & StateProps> = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPinned) return undefined;
|
||||
const id = album ? album.messages[album.messages.length - 1].id : messageId;
|
||||
const id = album ? album.mainMessage.id : messageId;
|
||||
|
||||
return () => {
|
||||
onPinnedIntersectionChange({ viewportPinnedIdsToRemove: [id], isUnmount: true });
|
||||
@ -1188,6 +1188,7 @@ const Message: FC<OwnProps & StateProps> = ({
|
||||
className="bottom-marker"
|
||||
data-message-id={messageId}
|
||||
data-last-message-id={album ? album.messages[album.messages.length - 1].id : undefined}
|
||||
data-album-main-id={album ? album.mainMessage.id : undefined}
|
||||
data-has-unread-mention={message.hasUnreadMention || undefined}
|
||||
data-has-unread-reaction={hasUnreadReaction || undefined}
|
||||
data-is-pinned={isPinned || undefined}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user