kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Fix duplicate issue in filters
rodzic
327874b9e5
commit
01436f31df
|
@ -380,7 +380,7 @@ const LanguageFilter = () => {
|
|||
</Text>
|
||||
|
||||
<SelectDropdown
|
||||
key={filter?.name}
|
||||
key={filter?.value}
|
||||
className='max-w-[130px]'
|
||||
items={languages}
|
||||
defaultValue={filter.name.toLowerCase()}
|
||||
|
@ -467,7 +467,7 @@ const generateFilter = (dispatch: AppDispatch, intl: IntlShape, { name, value, s
|
|||
|
||||
return (
|
||||
<div
|
||||
key={name}
|
||||
key={value}
|
||||
className={`group m-1 flex items-center whitespace-normal break-words rounded-full border-2 bg-transparent px-3 pr-1 text-base font-medium shadow-sm hover:cursor-pointer ${borderColor} ${textColor} `}
|
||||
>
|
||||
{name.toLowerCase() !== 'default' ? name : <FormattedMessage id='column.explore.filters.language.default' defaultMessage='Global' />}
|
||||
|
|
|
@ -125,9 +125,10 @@ const search_filter = createSlice({
|
|||
const filterWords = action.payload.name.trim();
|
||||
const status = action.payload.status;
|
||||
const value = status ? filterWords : `-${filterWords.split(' ').join(' -')}`;
|
||||
return state.some((currentState) => currentState.name === filterWords)
|
||||
? state
|
||||
: [...state, { name: filterWords, status: status, value: value }];
|
||||
if (state.slice(7).some((currentState) => currentState.name === filterWords)) {
|
||||
return state;
|
||||
}
|
||||
return [...state, { name: filterWords, status, value }];
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Ładowanie…
Reference in New Issue