fixup edit handling

This commit is contained in:
Henry Hiles 2026-09-29 09:45:51 -04:00
commit bd7cd0b10c
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -47,7 +47,7 @@ class const EventRenderer(
final focusNode = useFocusNode(); final focusNode = useFocusNode();
useListenable(focusNode); useListenable(focusNode);
final (event, previousEvent) = ref.watch( final (initialEvent, previousEvent) = ref.watch(
RoomsController.provider.select( RoomsController.provider.select(
(value) => ( (value) => (
value[roomId]?.events[eventRowId], value[roomId]?.events[eventRowId],
@ -58,7 +58,22 @@ class const EventRenderer(
), ),
); );
if (event == null) return SizedBox.shrink(); if (initialEvent == null) return SizedBox.shrink();
final edited = initialEvent.lastEditRowId == 0
? null
: ref.watch(
RoomsController.provider.select(
(value) => value[roomId]?.events[initialEvent.lastEditRowId],
),
);
final event = edited == null
? initialEvent
: initialEvent.copyWith(
content: edited.content,
localContent: edited.localContent,
);
final isGrouped = final isGrouped =
previousEvent?.content is MessageContent && previousEvent?.content is MessageContent &&