keep message drafts on room switches

this is for you courge
This commit is contained in:
Henry Hiles 2026-11-05 20:44:13 -05:00
commit e899bb3929
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 357 additions and 194 deletions

View file

@ -122,9 +122,9 @@ final class const ChatBody({
.send(
text,
tags: tags,
relationType: composer.relationType.value,
relationType: composer.relationType,
shouldMention: shouldMention,
relatedEventRowId: composer.relatedEvent.value,
relatedEventRowId: composer.relatedEvent,
)
.onError(showError),
onSendSticker: (shortcode, image, {required shouldMention}) =>
@ -153,12 +153,6 @@ final class const ChatBody({
onSendBotCommand: (draft) => notifier
.sendBotCommand(draft, repliedEventRowId: repliedEventRowId)
.onError(showError),
relationType: composer.relationType.value,
relatedEvent: composer.relatedEvent.value,
onDismiss: () {
composer.relatedEvent.value = null;
composer.node.requestFocus();
},
),
},
),

View file

@ -29,7 +29,6 @@ final class const RoomChat({
}) extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final composer = ChatComposer.use();
final pendingJump = ref.read(JumpRequestController.provider);
final contextualEvent = useState<int?>(switch (pendingJump) {
// Threaded events open their thread instead, leaving the timeline
@ -76,6 +75,7 @@ final class const RoomChat({
}
final roomId = this.roomId!;
final composer = ChatComposer.use(ref, (roomId: roomId, threadRoot: null));
final jumpRowId = ref.watch(
JumpRequestController.provider.select(