@appcorp/fusion-storybook 0.1.77 → 0.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -115,7 +115,7 @@ export declare const useClassModule: () => {
|
|
|
115
115
|
handleEdit: (row?: TableRow) => void;
|
|
116
116
|
handleFilters: () => void;
|
|
117
117
|
handleMoreActions: () => void;
|
|
118
|
-
handlePageChange: (
|
|
118
|
+
handlePageChange: (pageOrEvent?: unknown) => void;
|
|
119
119
|
handlePageLimitChange: (k: string, value: object) => void;
|
|
120
120
|
handleSearch: (query: string) => void;
|
|
121
121
|
handleSubmit: () => void;
|
|
@@ -272,12 +272,19 @@ export const useClassModule = () => {
|
|
|
272
272
|
payload: { drawer: CLASS_DRAWER.MORE_ACTIONS_DRAWER },
|
|
273
273
|
});
|
|
274
274
|
}, [dispatch]);
|
|
275
|
-
const handlePageChange = useCallback((
|
|
275
|
+
const handlePageChange = useCallback((pageOrEvent) => {
|
|
276
|
+
// The factory passes handlePageChange directly as the Next button's onClick
|
|
277
|
+
// handler (receiving a MouseEvent), but wraps Previous as () => handlePageChange(currentPage - 1).
|
|
278
|
+
// We detect which case we're in: a valid number means an explicit page target
|
|
279
|
+
// (Previous path); anything else means "advance to next page".
|
|
280
|
+
const page = typeof pageOrEvent === "number" && !isNaN(pageOrEvent)
|
|
281
|
+
? pageOrEvent
|
|
282
|
+
: state.currentPage + 1;
|
|
276
283
|
dispatch({
|
|
277
284
|
type: CLASS_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
278
285
|
payload: { currentPage: page },
|
|
279
286
|
});
|
|
280
|
-
}, [dispatch]);
|
|
287
|
+
}, [dispatch, state.currentPage]);
|
|
281
288
|
const handlePageLimitChange = useCallback((k, value) => {
|
|
282
289
|
const val = Object.assign({}, value);
|
|
283
290
|
dispatch({
|
|
@@ -317,9 +324,8 @@ export const useClassModule = () => {
|
|
|
317
324
|
type: CLASS_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
318
325
|
payload: { currentPage: 1 },
|
|
319
326
|
});
|
|
320
|
-
listFetchNow();
|
|
321
327
|
closeDrawer();
|
|
322
|
-
}, [dispatch,
|
|
328
|
+
}, [dispatch, closeDrawer]);
|
|
323
329
|
const clearFilters = useCallback(() => {
|
|
324
330
|
dispatch({
|
|
325
331
|
type: CLASS_ACTION_TYPES.SET_FILTERS,
|