Fix infinite stacking All Media with shortcut

This commit is contained in:
ayumi-signal 2023-11-07 15:00:25 -08:00 committed by GitHub
parent f52da976f9
commit 41e89554fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ import type { ThunkAction } from 'redux-thunk';
import { import {
difference, difference,
fromPairs, fromPairs,
isEqual,
omit, omit,
orderBy, orderBy,
pick, pick,
@ -2955,12 +2956,19 @@ function pushPanelForConversation(
panel: PanelRequestType panel: PanelRequestType
): ThunkAction<void, RootStateType, unknown, PushPanelActionType> { ): ThunkAction<void, RootStateType, unknown, PushPanelActionType> {
return async (dispatch, getState) => { return async (dispatch, getState) => {
const { conversations } = getState();
const { targetedConversationPanels } = conversations;
const activePanel =
targetedConversationPanels.stack[targetedConversationPanels.watermark];
if (panel.type === activePanel?.type && isEqual(panel, activePanel)) {
return;
}
if (panel.type === PanelType.MessageDetails) { if (panel.type === PanelType.MessageDetails) {
const { messageId } = panel.args; const { messageId } = panel.args;
const state = getState();
const message = const message =
state.conversations.messagesLookup[messageId] || conversations.messagesLookup[messageId] ||
(await __DEPRECATED$getMessageById(messageId))?.attributes; (await __DEPRECATED$getMessageById(messageId))?.attributes;
if (!message) { if (!message) {
throw new Error( throw new Error(