Allow managing collection accounts (#37812)

This commit is contained in:
diondiondion authored and GitHub committed 2026-02-16 18:17:20 +00:00
1 parent cff25c186b
commit a644a4a762
15 files changed
+590 -75

No files matched your search

@@ -165,10 +165,11 @@ const ListMembers: React.FC<{
const [mode, setMode] = useState<Mode>('remove');
const {
accountIds: searchAccountIds = [],
accountIds: searchAccountIds,
isLoading: loadingSearchResults,
searchAccounts: handleSearch,
} = useSearchAccounts({
resetOnInputClear: false,
onSettled: (value) => {
if (value.trim().length === 0) {
setSearching(false);
@@ -8,13 +8,15 @@ import type { ApiAccountJSON } from 'mastodon/api_types/accounts';
import { useAppDispatch } from 'mastodon/store';
export function useSearchAccounts({
resetOnInputClear = true,
onSettled,
}: {
onSettled?: (value: string) => void;
resetOnInputClear?: boolean;
} = {}) {
const dispatch = useAppDispatch();
const [accountIds, setAccountIds] = useState<string[]>();
const [accountIds, setAccountIds] = useState<string[]>([]);
const [loadingState, setLoadingState] = useState<
'idle' | 'loading' | 'error'
>('idle');
@@ -29,6 +31,9 @@ export function useSearchAccounts({
if (value.trim().length === 0) {
onSettled?.('');
if (resetOnInputClear) {
setAccountIds([]);
}
return;
}