Files
bigcapital/client/src/store/items/items.selectors.js
a.bouhuolia af34986aac feat: style read-only drawers.
fix: empty state in resources tables.
2021-08-24 14:57:19 +02:00

26 lines
753 B
JavaScript

import { isEqual } from 'lodash';
import { paginationLocationQuery } from 'store/selectors';
import { createDeepEqualSelector } from 'utils';
import { defaultTableQuery } from './items.reducer';
const itemsTableStateSelector = (state) => state.items.tableState;
// Get items table state marged with location query.
export const getItemsTableStateFactory = () =>
createDeepEqualSelector(
paginationLocationQuery,
itemsTableStateSelector,
(locationQuery, tableState) => {
return {
...locationQuery,
...tableState,
};
},
);
export const isItemsTableStateChangedFactory = () =>
createDeepEqualSelector(itemsTableStateSelector, (tableState) => {
return !isEqual(tableState, defaultTableQuery);
});