mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
feat(app): follow the newest forward target for mention autocomplete (#2001)
This commit is contained in:
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,
|
||||
|
||||
Reference in new issue
Block a user