fix issues.

This commit is contained in:
Ahmed Bouhuolia
2020-05-05 04:21:37 +02:00
parent 3b25056cbe
commit bd7eb0eb76
41 changed files with 364 additions and 216 deletions

View File

@@ -21,7 +21,9 @@ import DataTable from 'components/DataTable';
import Money from 'components/Money';
import { useUpdateEffect } from 'hooks';
function AccountsDataTable({
loading,
accounts,
onDeleteAccount,
onInactiveAccount,
@@ -34,7 +36,6 @@ function AccountsDataTable({
onFetchData,
onSelectedRowsChange
}) {
const {custom_view_id: customViewId} = useParams();
const [initialMount, setInitialMount] = useState(false);
useUpdateEffect(() => {
@@ -43,19 +44,6 @@ function AccountsDataTable({
}
}, [accountsLoading, setInitialMount]);
useEffect(() => {
const viewMeta = getViewItem(customViewId);
if (customViewId) {
changeCurrentView(customViewId);
setTopbarEditView(customViewId);
}
changePageSubtitle((customViewId && viewMeta) ? viewMeta.name : '');
}, [customViewId]);
// Clear page subtitle when unmount the page.
useEffect(() => () => { changePageSubtitle(''); }, []);
const handleEditAccount = useCallback((account) => () => {
openDialog('account-form', { action: 'edit', id: account.id });
}, [openDialog]);
@@ -173,17 +161,19 @@ function AccountsDataTable({
}, [onSelectedRowsChange]);
return (
<DataTable
columns={columns}
data={accounts}
onFetchData={handleDatatableFetchData}
manualSortBy={true}
selectionColumn={selectionColumn}
expandable={true}
treeGraph={true}
onSelectedRowsChange={handleSelectedRowsChange}
loading={accountsLoading && !initialMount}
spinnerProps={{size: 30}} />
<LoadingIndicator loading={loading} mount={false}>
<DataTable
columns={columns}
data={accounts}
onFetchData={handleDatatableFetchData}
manualSortBy={true}
selectionColumn={selectionColumn}
expandable={true}
treeGraph={true}
onSelectedRowsChange={handleSelectedRowsChange}
loading={accountsLoading && !initialMount}
spinnerProps={{size: 30}} />
</LoadingIndicator>
);
}