Port 62603508c7343f0b9ef880bcbed67c70a9e8375d to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
16 lines
512 B
TypeScript
16 lines
512 B
TypeScript
import { createSelector } from '@reduxjs/toolkit';
|
|
import type { Map as ImmutableMap } from 'immutable';
|
|
|
|
import type { List } from 'flavours/glitch/models/list';
|
|
import type { RootState } from 'flavours/glitch/store';
|
|
|
|
export const getOrderedLists = createSelector(
|
|
[(state: RootState) => state.lists],
|
|
(lists: ImmutableMap<string, List | null>) =>
|
|
lists
|
|
.toList()
|
|
.filter((item: List | null) => !!item)
|
|
.sort((a: List, b: List) => a.title.localeCompare(b.title))
|
|
.toArray(),
|
|
);
|