Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(app): stop thread pane freezing when editing its message (#3530)

Hampus1a772daa4795
diff --git a/fluxer_app/src/features/channel/components/LexicalChannelTextareaContent.tsx b/fluxer_app/src/features/channel/components/LexicalChannelTextareaContent.tsx
index 7f59ad863..99dc0557d 100644
--- a/fluxer_app/src/features/channel/components/LexicalChannelTextareaContent.tsx
+++ b/fluxer_app/src/features/channel/components/LexicalChannelTextareaContent.tsx
@@ -189,8 +189,9 @@ export const LexicalChannelTextareaContent = observer(
}) => {
const {i18n} = useLingui();
const composerKey = draftChannelId ?? channel.id;
- const editingMessageId = MessageEdit.getEditingMessageId(channel.id);
- const editingMobileMessageId = MessageEditMobile.getEditingMobileMessageId(channel.id);
+ const ownsChannelEdits = draftChannelId == null;
+ const editingMessageId = ownsChannelEdits ? MessageEdit.getEditingMessageId(channel.id) : null;
+ const editingMobileMessageId = ownsChannelEdits ? MessageEditMobile.getEditingMobileMessageId(channel.id) : null;
const isEditingMessageInComposer = editingMobileMessageId != null;
let initialDraftDisplay = '';
if (!disabled && !isEditingMessageInComposer && draft !== null) {
@@ -810,8 +811,7 @@ export const LexicalChannelTextareaContent = observer(
}
}, []);
const dismissTopmostComposerAffordance = useCallback((): boolean => {
- const editingInline = MessageEdit.getEditingMessageId(channel.id) !== null;
- if (editingInline) {
+ if (editingMessageId !== null) {
MessageCommands.stopEdit(channel.id);
return true;
}
@@ -846,6 +846,7 @@ export const LexicalChannelTextareaContent = observer(
channel.id,
composerKey,
editingMessageForComposer,
+ editingMessageId,
focusComposer,
handleCancelEdit,
handleClearSlashCommand,
diff --git a/fluxer_app/src/features/threads/components/ThreadCreatePane.tsx b/fluxer_app/src/features/threads/components/ThreadCreatePane.tsx
index 71137bbb6..452ae30de 100644
--- a/fluxer_app/src/features/threads/components/ThreadCreatePane.tsx
+++ b/fluxer_app/src/features/threads/components/ThreadCreatePane.tsx
@@ -64,6 +64,7 @@ export const ThreadCreatePane = observer(({parent, messageId}: ThreadCreatePaneP
observer.observe(inertRoot, {attributes: true, attributeFilter: ['inert']});
return () => observer.disconnect();
}, []);
+ void Messages.version;
const sourceMessage = messageId ? Messages.getMessage(parent.id, messageId) : undefined;
const draftKey = `thread-create:${parent.id}`;
const accountKey = Users.viewAccountKey;