Skip to content

Commit 6bfd2b9

Browse files
authored
fix root element in thread looking wrongly selected (#929)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description Fix the topmost item in a thread looking highlighted when it shouldnt, but it still highlights if you specifically want to actually reply to it it <!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. --> Fixes # #### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. --> Written with the inspiration of eating by and by
2 parents c903b0e + 30a4abb commit 6bfd2b9

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/app/features/room/ThreadDrawer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra
230230
const setReplyDraft = useSetAtom(roomIdToReplyDraftAtomFamily(threadRootId));
231231
const replyDraft = useAtomValue(roomIdToReplyDraftAtomFamily(threadRootId));
232232
const activeReplyId = replyDraft?.eventId;
233+
const suppressMark = !replyDraft?.body;
233234

234235
// User profile popup
235236
const openUserRoomProfile = useOpenUserRoomProfile();
@@ -711,7 +712,7 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra
711712
showHiddenEvents,
712713
hideThreadChip: true,
713714
},
714-
state: { focusItem, editId, activeReplyId, openThreadId: threadRootId },
715+
state: { focusItem, editId, activeReplyId, openThreadId: threadRootId, suppressMark },
715716
permissions: {
716717
canRedact,
717718
canDeleteOwn,

src/app/hooks/timeline/useTimelineEventRenderer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ export interface TimelineEventRendererOptions {
286286
editId?: string;
287287
activeReplyId?: string;
288288
openThreadId?: string;
289+
suppressMark?: boolean;
289290
};
290291
permissions: {
291292
canRedact: boolean;
@@ -337,7 +338,7 @@ export function useTimelineEventRenderer({
337338
showHiddenEvents,
338339
hideThreadChip,
339340
},
340-
state: { focusItem, editId, activeReplyId, openThreadId },
341+
state: { focusItem, editId, activeReplyId, openThreadId, suppressMark },
341342
permissions: { canRedact, canDeleteOwn, canSendReaction, canPinEvent },
342343
callbacks: {
343344
onUserClick,
@@ -375,7 +376,7 @@ export function useTimelineEventRenderer({
375376
const reactions = reactionRelations?.getSortedAnnotationsByKey();
376377
const hasReactions = reactions && reactions.length > 0;
377378
const highlighted = focusItem?.index === item && focusItem.highlight;
378-
const marked = activeReplyId === mEventId;
379+
const marked = activeReplyId === mEventId && suppressMark !== true;
379380

380381
const pushActions = pushProcessor.actionsForEvent(mEvent);
381382
let notifyHighlight: 'silent' | 'loud' | undefined;

0 commit comments

Comments
 (0)