A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(app): stop pending stickers from reloading the channel (#2890)
Hampus31c53d2dff70
diff --git a/fluxer_app/src/features/channel/components/ChannelStickersArea.tsx b/fluxer_app/src/features/channel/components/ChannelStickersArea.tsxindex 92a7f22c4..b35c9655b 100644--- a/fluxer_app/src/features/channel/components/ChannelStickersArea.tsx+++ b/fluxer_app/src/features/channel/components/ChannelStickersArea.tsx@@ -4,7 +4,6 @@ import * as ChannelStickerCommands from '@app/features/channel/commands/ChannelSimport styles from '@app/features/channel/components/ChannelStickersArea.module.css';import ChannelSticker from '@app/features/channel/state/ChannelSticker';import {useStickerAnimation} from '@app/features/emoji/hooks/useStickerAnimation';-import {ComponentBus} from '@app/features/platform/utils/ComponentBus';import {StickerContextMenuItems} from '@app/features/ui/action_menu/items/StickerContextMenuItems';import * as ContextMenuCommands from '@app/features/ui/commands/ContextMenuCommands';import FocusRing from '@app/features/ui/focus_ring/FocusRing';@@ -16,7 +15,6 @@ import {TrashIcon} from '@phosphor-icons/react';import {clsx} from 'clsx';import {observer} from 'mobx-react-lite';import type React from 'react';-import {useEffect, useState} from 'react';const REMOVE_STICKER_DESCRIPTOR = msg({message: 'Remove sticker',@@ -33,15 +31,6 @@ export const ChannelStickersArea: React.FC<ChannelStickersAreaProps> = observer(const {i18n} = useLingui();const sticker = ChannelSticker.getPendingSticker(channelId);const {shouldAnimate, interactionHandlers} = useStickerAnimation({isAnimated: sticker?.animated ?? false});- const [previousSticker, setPreviousSticker] = useState(sticker);- useEffect(() => {- if (previousSticker && !sticker) {- ComponentBus.dispatch('FORCE_JUMP_TO_PRESENT');- } else if (!previousSticker && sticker) {- ComponentBus.dispatch('FORCE_JUMP_TO_PRESENT');- }- setPreviousSticker(sticker);- }, [sticker, previousSticker]);if (!sticker) {return null;}diff --git a/fluxer_app/src/features/channel/components/LexicalChannelTextareaContent.tsx b/fluxer_app/src/features/channel/components/LexicalChannelTextareaContent.tsxindex ca1d2c788..92b25ceb6 100644--- a/fluxer_app/src/features/channel/components/LexicalChannelTextareaContent.tsx+++ b/fluxer_app/src/features/channel/components/LexicalChannelTextareaContent.tsx@@ -707,7 +707,8 @@ export const LexicalChannelTextareaContent = observer(const stickerBoundaryChanged = isSameChannel && previous.hasPendingSticker !== hasPendingSticker;if (wasAtBottomBeforeComposerBoundaryChange.current &&- (stickerBoundaryChanged || (attachmentBoundaryChanged && Messages.getMessages(channel.id).hasMoreAfter))+ (stickerBoundaryChanged || attachmentBoundaryChanged) &&+ Messages.getMessages(channel.id).hasMoreAfter) {ComponentBus.dispatch('FORCE_JUMP_TO_PRESENT', {channelId: channel.id});}