feat(app): follow the newest forward target for mention autocomplete (#2001)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-25 12:57:06 +02:00
1 parent 42e45a0e3a
commit 1153327c75
2 files changed
+24 -8

No files matched your search

@@ -27,6 +27,7 @@ export interface ForwardChannelSelectionState {
readonly handleToggleChannel: (channelId: string) => void;
readonly isChannelSelectionDisabled: (option: ForwardChannelOption) => boolean;
readonly maxSelections: number;
readonly mostRecentlySelectedChannelId: string | null;
readonly searchQuery: string;
readonly selectedChannelIds: ReadonlySet<string>;
readonly setSearchQuery: Dispatch<SetStateAction<string>>;
@@ -104,12 +105,20 @@ export function useForwardChannelSelection({
() => selectedChannelOptions.filter((option) => option.slowmodeRemainingMs > 0),
[selectedChannelOptions],
);
const mostRecentlySelectedChannelId = useMemo(() => {
let mostRecent: string | null = null;
for (const channelId of selectedChannelIds) {
mostRecent = channelId;
}
return mostRecent;
}, [selectedChannelIds]);
return {
filteredChannels,
handleToggleChannel,
isChannelSelectionDisabled,
maxSelections,
mostRecentlySelectedChannelId,
searchQuery,
selectedChannelIds,
setSearchQuery,