Folder Settings: Hide unknown chats (#4751)
This commit is contained in:
parent
43459b8ea9
commit
ff9a0e3fdf
@ -50,7 +50,7 @@ const SettingsFoldersChatFilters: FC<OwnProps & StateProps> = ({
|
||||
const { openLimitReachedModal } = getActions();
|
||||
|
||||
const { chatFilter } = state;
|
||||
const { selectedChatIds, selectedChatTypes } = selectChatFilters(state, mode, true);
|
||||
const { selectedChatIds, selectedChatTypes } = useMemo(() => selectChatFilters(state, mode, true), [mode, state]);
|
||||
const chatTypes = mode === 'included' ? CUSTOM_PEER_INCLUDED_CHAT_TYPES : CUSTOM_PEER_EXCLUDED_CHAT_TYPES;
|
||||
|
||||
const [isTouched, setIsTouched] = useState(false);
|
||||
|
||||
@ -113,11 +113,11 @@ const SettingsFoldersEdit: FC<OwnProps & StateProps> = ({
|
||||
const {
|
||||
selectedChatIds: includedChatIds,
|
||||
selectedChatTypes: includedChatTypes,
|
||||
} = selectChatFilters(state, 'included');
|
||||
} = useMemo(() => selectChatFilters(state, 'included'), [state]);
|
||||
const {
|
||||
selectedChatIds: excludedChatIds,
|
||||
selectedChatTypes: excludedChatTypes,
|
||||
} = selectChatFilters(state, 'excluded');
|
||||
} = useMemo(() => selectChatFilters(state, 'excluded'), [state]);
|
||||
|
||||
useEffect(() => {
|
||||
setIsIncludedChatsListExpanded(false);
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
import { getGlobal } from '../../global';
|
||||
|
||||
import type { ApiChatFolder } from '../../api/types';
|
||||
import type { IconName } from '../../types/icons';
|
||||
import type { Dispatch, StateReducer } from '../useReducer';
|
||||
|
||||
import { selectChat } from '../../global/selectors';
|
||||
import { omit, pick } from '../../util/iteratees';
|
||||
import useReducer from '../useReducer';
|
||||
|
||||
@ -69,8 +72,11 @@ export function selectChatFilters(state: FoldersState, mode: 'included' | 'exclu
|
||||
.filter((key) => Boolean(excludeFilters[key]));
|
||||
}
|
||||
|
||||
const global = getGlobal();
|
||||
const existingSelectedChatIds = selectedChatIds.filter((id) => selectChat(global, id));
|
||||
|
||||
return {
|
||||
selectedChatIds,
|
||||
selectedChatIds: existingSelectedChatIds,
|
||||
selectedChatTypes,
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user