Use Immutable Record
for accounts in Redux state (#26559)
This commit is contained in:
parent
9d799d40ba
commit
3bf2a7296e
65 changed files with 765 additions and 662 deletions
|
@ -5,23 +5,7 @@ import { toServerSideType } from 'mastodon/utils/filters';
|
|||
|
||||
import { me } from '../initial_state';
|
||||
|
||||
const getAccountBase = (state, id) => state.getIn(['accounts', id], null);
|
||||
const getAccountCounters = (state, id) => state.getIn(['accounts_counters', id], null);
|
||||
const getAccountRelationship = (state, id) => state.getIn(['relationships', id], null);
|
||||
const getAccountMoved = (state, id) => state.getIn(['accounts', state.getIn(['accounts', id, 'moved'])]);
|
||||
|
||||
export const makeGetAccount = () => {
|
||||
return createSelector([getAccountBase, getAccountCounters, getAccountRelationship, getAccountMoved], (base, counters, relationship, moved) => {
|
||||
if (base === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return base.merge(counters).withMutations(map => {
|
||||
map.set('relationship', relationship);
|
||||
map.set('moved', moved);
|
||||
});
|
||||
});
|
||||
};
|
||||
export { makeGetAccount } from "./accounts";
|
||||
|
||||
const getFilters = (state, { contextType }) => {
|
||||
if (!contextType) return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue