mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat: style read-only drawers.
fix: empty state in resources tables.
This commit is contained in:
@@ -4,12 +4,15 @@ import storage from 'redux-persist/lib/storage';
|
||||
import { createTableStateReducers } from 'store/tableState.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
|
||||
export const defaultTableQuery = {
|
||||
pageSize: 12,
|
||||
pageIndex: 0,
|
||||
filterRoles: [],
|
||||
};
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
pageSize: 12,
|
||||
pageIndex: 0,
|
||||
filterRoles: [],
|
||||
},
|
||||
tableState: defaultTableQuery,
|
||||
};
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:accounts';
|
||||
@@ -21,7 +24,7 @@ const CONFIG = {
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('ACCOUNTS'),
|
||||
...createTableStateReducers('ACCOUNTS', defaultTableQuery),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { isEqual } from 'lodash';
|
||||
|
||||
import { paginationLocationQuery } from 'store/selectors';
|
||||
import { createDeepEqualSelector } from 'utils';
|
||||
import { defaultTableQuery } from './accounts.reducer';
|
||||
|
||||
// Accounts table state selector
|
||||
const accountsTableStateSelector = (state, props) => state.accounts.tableState;
|
||||
@@ -16,3 +19,8 @@ export const getAccountsTableStateFactory = () =>
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
export const accountsTableStateChangedFactory = () =>
|
||||
createDeepEqualSelector(accountsTableStateSelector, (tableState) => {
|
||||
return !isEqual(tableState, defaultTableQuery);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
export default {
|
||||
ACCOUNTS_TABLE_STATE_SET: 'ACCOUNTS/TABLE_STATE_SET',
|
||||
ACCOUNTS_TABLE_STATE_RESET: 'ACCOUNTS/TABLE_STATE_RESET',
|
||||
};
|
||||
Reference in New Issue
Block a user