Refactor <FavouritedStatuses>
and <BookmarkedStatuses>
into TypeScript (#34356)
This commit is contained in:
parent
bdf9baa2e8
commit
6a39f00745
7 changed files with 249 additions and 234 deletions
|
@ -6,6 +6,7 @@ import { me } from '../initial_state';
|
|||
import { getFilters } from './filters';
|
||||
|
||||
export { makeGetAccount } from "./accounts";
|
||||
export { getStatusList } from "./statuses";
|
||||
|
||||
export const makeGetStatus = () => {
|
||||
return createSelector(
|
||||
|
@ -77,7 +78,3 @@ export const makeGetReport = () => createSelector([
|
|||
(_, base) => base,
|
||||
(state, _, targetAccountId) => state.getIn(['accounts', targetAccountId]),
|
||||
], (base, targetAccount) => base.set('target_account', targetAccount));
|
||||
|
||||
export const getStatusList = createSelector([
|
||||
(state, type) => state.getIn(['status_lists', type, 'items']),
|
||||
], (items) => items.toList());
|
||||
|
|
15
app/javascript/mastodon/selectors/statuses.ts
Normal file
15
app/javascript/mastodon/selectors/statuses.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import type { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||
|
||||
import type { RootState } from 'mastodon/store';
|
||||
|
||||
export const getStatusList = createSelector(
|
||||
[
|
||||
(
|
||||
state: RootState,
|
||||
type: 'favourites' | 'bookmarks' | 'pins' | 'trending',
|
||||
) =>
|
||||
state.status_lists.getIn([type, 'items']) as ImmutableOrderedSet<string>,
|
||||
],
|
||||
(items) => items.toList(),
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue