mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
re-structure to monorepo.
This commit is contained in:
26
packages/webapp/src/store/items/items.selectors.tsx
Normal file
26
packages/webapp/src/store/items/items.selectors.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
// @ts-nocheck
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user