remove-immutable-compose
danidfra 2025-01-20 18:15:30 -03:00
rodzic f4887ab5ab
commit 771f5e3219
3 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -123,7 +123,7 @@ const setFilter = (filterType: SearchFilter) =>
const expandSearch = (type: SearchFilter) => (dispatch: AppDispatch, getState: () => RootState) => {
const value = getState().search.value;
const offset = getState().search.results[type].size;
const offset = type !== 'hashtags' ? getState().search.results?.[type].size : getState().search.results[type].length;
const accountId = getState().search.accountId;
dispatch(expandSearchRequest(type));

Wyświetl plik

@ -49,7 +49,7 @@ const SearchResults = () => {
const { account } = useAccount(filterByAccount);
const handleLoadMore = () => {
if (results.accounts.size || results.statuses.size || results.hashtags.size) {
if (results.accounts.size || results.statuses.size || results.hashtags.length) {
dispatch(expandSearch(selectedFilter));
} else if (nextTrendingStatuses) {
dispatch(expandTrendingStatuses(nextTrendingStatuses));
@ -197,7 +197,7 @@ const SearchResults = () => {
loaded = results.hashtagsLoaded;
placeholderComponent = PlaceholderHashtag;
if (results.hashtags && results.hashtags.size > 0) {
if (results.hashtags && results.hashtags.length > 0) {
searchResults = [...results.hashtags].map(hashtag => <Hashtag key={hashtag.name} hashtag={hashtag} />);
} else if (!submitted && suggestions && !suggestions.isEmpty()) {
searchResults = trends.map(hashtag => <Hashtag key={hashtag.name} hashtag={hashtag} />);

Wyświetl plik

@ -29,7 +29,7 @@ const ResultsRecord = ImmutableRecord({
accounts: ImmutableOrderedSet<string>(),
statuses: ImmutableOrderedSet<string>(),
groups: ImmutableOrderedSet<string>(),
hashtags: new Set<Tag>(), // it's a list of maps
hashtags: [] as Tag[], // it's a list of maps
accountsHasMore: false,
statusesHasMore: false,
groupsHasMore: false,
@ -66,7 +66,7 @@ const importResults = (state: State, results: APIEntity, searchTerm: string, sea
statuses: toIds(results.statuses),
accounts: toIds(results.accounts),
groups: toIds(results.groups),
hashtags: new Set(results.hashtags.map(tagSchema.parse)), // it's a list of records
hashtags: results.hashtags.map(tagSchema.parse), // it's a list of records
accountsHasMore: results.accounts.length >= 20,
statusesHasMore: results.statuses.length >= 20,
groupsHasMore: results.groups?.length >= 20,