Files
bigcapital/packages/webapp/src/store/Invoice/invoices.selector.tsx
Ahmed Bouhuolia 2383091b6e wip
2025-11-12 21:34:30 +02:00

41 lines
1.1 KiB
TypeScript

// @ts-nocheck
import { isEqual } from 'lodash';
import { paginationLocationQuery } from '@/store/selectors';
import { createDeepEqualSelector } from '@/utils';
import { defaultTableQuery } from './invoices.reducer';
import { createSelector } from 'reselect';
const invoicesTableStateSelector = (state) => state.salesInvoices.tableState;
/**
* Retrieve invoices table state.
*/
export const getInvoicesTableStateFactory = () =>
createDeepEqualSelector(
paginationLocationQuery,
invoicesTableStateSelector,
(locationQuery, tableState) => {
return {
...locationQuery,
...tableState,
};
},
);
/**
* Retrieve invoices table state.
*/
export const isInvoicesTableStateChangedFactory = () =>
createDeepEqualSelector(invoicesTableStateSelector, (tableState) => {
return !isEqual(tableState, defaultTableQuery);
});
/**
* Retrieve invoices selected rows.
*/
export const getInvoicesSelectedRowsFactory = () =>
createSelector(
(state) => state.salesInvoices.selectedRows,
(selectedRows) => selectedRows,
);