Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: inconsistance page size of paginated data tables #604

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/webapp/src/components/Datatable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function DataTable(props) {

// Pagination props.
initialPageIndex = 0,
initialPageSize = 10,
initialPageSize = 20,

updateDebounceTime = 200,
selectionColumnWidth = 42,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ function ManualJournalsDataTable({
loading={isManualJournalsLoading}
headerLoading={isManualJournalsLoading}
progressBarLoading={isManualJournalsFetching}
pagesCount={pagination.pagesCount}
pagination={true}
initialPageSize={manualJournalsTableState.pageSize}
pagesCount={pagination.pagesCount}
autoResetSortBy={false}
autoResetPage={false}
TableLoadingRenderer={TableSkeletonRows}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ function CustomersTable({
sticky={true}
spinnerProps={{ size: 30 }}
pagination={true}
initialPageSize={customersTableState.pageSize}
manualSortBy={true}
manualPagination={true}
pagesCount={pagination.pagesCount}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import withExpensesActions from './withExpensesActions';
import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withSettings from '@/containers/Settings/withSettings';
import withExpenses from './withExpenses';

import { ActionsMenu, useExpensesTableColumns } from './components';
import { DRAWERS } from '@/constants/drawers';
Expand All @@ -39,6 +40,9 @@ function ExpensesDataTable({

// #withSettings
expensesTableSize,

// #withExpenses
expensesTableState
}) {
// Expenses list context.
const {
Expand Down Expand Up @@ -116,6 +120,7 @@ function ExpensesDataTable({
sticky={true}
onFetchData={handleFetchData}
pagination={true}
initialPageSize={expensesTableState.pageSize}
manualSortBy={true}
manualPagination={true}
pagesCount={pagination.pagesCount}
Expand Down Expand Up @@ -147,4 +152,5 @@ export default compose(
withSettings(({ expenseSettings }) => ({
expensesTableSize: expenseSettings?.tableSize,
})),
withExpenses(({ expensesTableState }) => ({ expensesTableState }))
)(ExpensesDataTable);
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function InventoryAdjustmentDataTable({
manualSortBy={true}
selectionColumn={true}
pagination={true}
initialPageSize={inventoryAdjustmentTableState.pageSize}
pagesCount={pagination.pagesCount}
autoResetSortBy={false}
autoResetPage={false}
Expand Down
6 changes: 6 additions & 0 deletions packages/webapp/src/containers/Items/ItemsDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withSettings from '@/containers/Settings/withSettings';
import withItems from './withItems';

import { useItemsListContext } from './ItemsListProvider';
import { useItemsTableColumns, ItemsActionMenuList } from './components';
Expand All @@ -43,6 +44,9 @@ function ItemsDataTable({
// #withSettings
itemsTableSize,

// #withItems
itemsTableState,

// #ownProps
tableProps,
}) {
Expand Down Expand Up @@ -137,6 +141,7 @@ function ItemsDataTable({
sticky={true}
rowClassNames={rowClassNames}
pagination={true}
initialPageSize={itemsTableState.pageSize}
manualSortBy={true}
manualPagination={true}
pagesCount={pagination.pagesCount}
Expand Down Expand Up @@ -174,4 +179,5 @@ export default compose(
withSettings(({ itemsSettings }) => ({
itemsTableSize: itemsSettings.tableSize,
})),
withItems(({ itemsTableState }) => ({ itemsTableState }))
)(ItemsDataTable);
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function BillsDataTable({
noInitialFetch={true}
sticky={true}
pagination={true}
initialPageSize={billsTableState.pageSize}
pagesCount={pagination.pagesCount}
TableLoadingRenderer={TableSkeletonRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
import withVendorsCreditNotes from './withVendorsCreditNotes';
import withSettings from '@/containers/Settings/withSettings';

import { useVendorsCreditNoteTableColumns, ActionsMenu } from './components';
Expand All @@ -32,6 +33,9 @@ function VendorsCreditNoteDataTable({
// #withVendorsCreditNotesActions
setVendorsCreditNoteTableState,

// #withVendorCredits
vendorsCreditNoteTableState,

// #withAlertsActions
openAlert,

Expand Down Expand Up @@ -129,6 +133,7 @@ function VendorsCreditNoteDataTable({
noInitialFetch={true}
sticky={true}
pagination={true}
initialPageSize={vendorsCreditNoteTableState.pageSize}
pagesCount={pagination.pagesCount}
TableLoadingRenderer={TableSkeletonRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader}
Expand Down Expand Up @@ -159,4 +164,7 @@ export default compose(
withSettings(({ vendorsCreditNoteSetting }) => ({
creditNoteTableSize: vendorsCreditNoteSetting?.tableSize,
})),
withVendorsCreditNotes(({ vendorsCreditNoteTableState }) => ({
vendorsCreditNoteTableState,
})),
)(VendorsCreditNoteDataTable);
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ function PaymentMadesTable({
noInitialFetch={true}
sticky={true}
pagination={true}
initialPageSize={paymentMadesTableState.pageSize}
pagesCount={pagination.pagesCount}
autoResetSortBy={false}
autoResetPage={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
import withCreditNotes from './withCreditNotes';

import { useCreditNoteTableColumns, ActionsMenu } from './components';
import { useCreditNoteListContext } from './CreditNotesListProvider';
Expand All @@ -44,6 +45,9 @@ function CreditNotesDataTable({

// #withSettings
creditNoteTableSize,

// #withCreditNotes
creditNoteTableState
}) {
const history = useHistory();

Expand Down Expand Up @@ -129,6 +133,7 @@ function CreditNotesDataTable({
noInitialFetch={true}
sticky={true}
pagination={true}
initialPageSize={creditNoteTableState.pageSize}
pagesCount={pagination.pagesCount}
TableLoadingRenderer={TableSkeletonRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader}
Expand Down Expand Up @@ -159,4 +164,5 @@ export default compose(
withSettings(({ creditNoteSettings }) => ({
creditNoteTableSize: creditNoteSettings?.tableSize,
})),
withCreditNotes(({ creditNoteTableState }) => ({ creditNoteTableState }))
)(CreditNotesDataTable);
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
import withEstimates from './withEstimates';

import { TABLES } from '@/constants/tables';
import {
Expand Down Expand Up @@ -42,6 +43,9 @@ function EstimatesDataTable({

// #withSettings
estimatesTableSize,

// #withEstimates
estimatesTableState
}) {
const history = useHistory();

Expand Down Expand Up @@ -141,6 +145,7 @@ function EstimatesDataTable({
selectionColumn={true}
sticky={true}
pagination={true}
initialPageSize={estimatesTableState.pageSize}
manualPagination={true}
pagesCount={pagination.pagesCount}
TableLoadingRenderer={TableSkeletonRows}
Expand Down Expand Up @@ -174,4 +179,5 @@ export default compose(
withSettings(({ estimatesSettings }) => ({
estimatesTableSize: estimatesSettings?.tableSize,
})),
withEstimates(({ estimatesTableState }) => ({ estimatesTableState }))
)(EstimatesDataTable);
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ function InvoicesDataTable({
noInitialFetch={true}
sticky={true}
pagination={true}
initialPageSize={invoicesTableState.pageSize}
manualPagination={true}
pagesCount={pagination.pagesCount}
autoResetSortBy={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function PaymentsReceivedDataTable({
// #withPaymentsReceivedActions
setPaymentReceivesTableState,

// #withPaymentsReceived
paymentReceivesTableState,

// #withAlertsActions
openAlert,

Expand Down Expand Up @@ -124,6 +127,7 @@ function PaymentsReceivedDataTable({
autoResetSortBy={false}
autoResetPage={false}
pagination={true}
initialPageSize={paymentReceivesTableState.pageSize}
pagesCount={pagination.pagesCount}
TableLoadingRenderer={TableSkeletonRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function ReceiptsDataTable({
noInitialFetch={true}
sticky={true}
pagination={true}
initialPageSize={receiptTableState.pageSize}
pagesCount={pagination.pagesCount}
manualPagination={true}
autoResetSortBy={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ function VendorsTable({
expandable={false}
sticky={true}
pagination={true}
initialPageSize={vendorsTableState.pageSize}
manualSortBy={true}
pagesCount={pagination.pagesCount}
autoResetSortBy={false}
Expand Down
Loading