@appcorp/fusion-storybook 0.1.78 → 0.1.80

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.
Files changed (39) hide show
  1. package/base-modules/admission/context.d.ts +1 -1
  2. package/base-modules/admission/context.js +38 -26
  3. package/base-modules/attendance/context.d.ts +1 -1
  4. package/base-modules/attendance/context.js +37 -18
  5. package/base-modules/campus/context.d.ts +1 -1
  6. package/base-modules/campus/context.js +40 -21
  7. package/base-modules/class/context.js +15 -8
  8. package/base-modules/course/context.d.ts +1 -1
  9. package/base-modules/course/context.js +37 -18
  10. package/base-modules/discount-code/context.d.ts +1 -1
  11. package/base-modules/discount-code/context.js +29 -20
  12. package/base-modules/enrollment/context.d.ts +1 -1
  13. package/base-modules/enrollment/context.js +37 -18
  14. package/base-modules/expense/context.d.ts +1 -1
  15. package/base-modules/expense/context.js +31 -20
  16. package/base-modules/family/context.d.ts +1 -1
  17. package/base-modules/family/context.js +36 -21
  18. package/base-modules/family-member/context.d.ts +1 -1
  19. package/base-modules/family-member/context.js +37 -21
  20. package/base-modules/fee-structure/context.d.ts +1 -1
  21. package/base-modules/fee-structure/context.js +29 -20
  22. package/base-modules/rbac/context.d.ts +1 -1
  23. package/base-modules/rbac/context.js +26 -22
  24. package/base-modules/section/context.d.ts +1 -1
  25. package/base-modules/section/context.js +26 -19
  26. package/base-modules/student-fee/context.d.ts +1 -1
  27. package/base-modules/student-fee/context.js +30 -20
  28. package/base-modules/student-profile/context.d.ts +1 -1
  29. package/base-modules/student-profile/context.js +34 -22
  30. package/base-modules/subject/context.d.ts +2 -2
  31. package/base-modules/subject/context.js +54 -30
  32. package/base-modules/teacher/context.d.ts +1 -1
  33. package/base-modules/teacher/context.js +29 -22
  34. package/base-modules/user/context.d.ts +1 -1
  35. package/base-modules/user/context.js +27 -20
  36. package/base-modules/workspace-user/context.d.ts +1 -1
  37. package/base-modules/workspace-user/context.js +32 -19
  38. package/package.json +1 -1
  39. package/tsconfig.build.tsbuildinfo +1 -1
@@ -111,6 +111,10 @@ export const useWorkspaceUserModule = () => {
111
111
  }), [state.enabled, state.id, state.roleId, state.userId, workspace === null || workspace === void 0 ? void 0 : workspace.id]);
112
112
  const byIdParams = useMemo(() => ({ id: state.id }), [state.id]);
113
113
  const deleteParams = useMemo(() => ({ id: state.id }), [state.id]);
114
+ const isDefaultListState = state.currentPage === 1 &&
115
+ state.pageLimit === pageLimit &&
116
+ !debouncedQuery &&
117
+ state.filterEnabled === undefined;
114
118
  // ============================================================================
115
119
  // 1.4.3 UTILITIES
116
120
  // ============================================================================
@@ -258,9 +262,8 @@ export const useWorkspaceUserModule = () => {
258
262
  type: WORKSPACE_USER_ACTION_TYPES.SET_CURRENT_PAGE,
259
263
  payload: { currentPage: 1 },
260
264
  });
261
- listFetchNow();
262
265
  handleCloseDrawer();
263
- }, [dispatch, listFetchNow, handleCloseDrawer]);
266
+ }, [dispatch, handleCloseDrawer]);
264
267
  const clearFilters = useCallback(() => {
265
268
  dispatch({
266
269
  type: WORKSPACE_USER_ACTION_TYPES.SET_FILTERS,
@@ -281,16 +284,21 @@ export const useWorkspaceUserModule = () => {
281
284
  const handleCreate = useCallback(() => { }, []);
282
285
  const handleEdit = useCallback(() => { }, []);
283
286
  const handlePageChange = useCallback((page) => {
287
+ const nextPage = typeof page === "number" ? page : state.currentPage + 1;
284
288
  dispatch({
285
289
  type: WORKSPACE_USER_ACTION_TYPES.SET_CURRENT_PAGE,
286
- payload: { currentPage: page },
290
+ payload: { currentPage: nextPage },
287
291
  });
288
- }, [dispatch]);
292
+ }, [dispatch, state.currentPage]);
289
293
  const handlePageLimitChange = useCallback((limit) => {
290
294
  dispatch({
291
295
  type: WORKSPACE_USER_ACTION_TYPES.SET_PAGE_LIMIT,
292
296
  payload: { pageLimit: limit },
293
297
  });
298
+ dispatch({
299
+ type: WORKSPACE_USER_ACTION_TYPES.SET_CURRENT_PAGE,
300
+ payload: { currentPage: 1 },
301
+ });
294
302
  }, [dispatch]);
295
303
  // ============================================================================
296
304
  // 1.4.7 NETWORK ACTIONS
@@ -353,23 +361,28 @@ export const useWorkspaceUserModule = () => {
353
361
  // 1.4.9 EFFECTS
354
362
  // ============================================================================
355
363
  useEffect(() => {
364
+ var _a;
356
365
  if (!(workspace === null || workspace === void 0 ? void 0 : workspace.id))
357
366
  return;
358
- (async () => {
359
- try {
360
- const { count, items } = await getCachedWorkspaceUsers({
361
- params: listParams,
362
- });
363
- dispatch({
364
- type: WORKSPACE_USER_ACTION_TYPES.SET_ITEMS,
365
- payload: { items: items || [], count: count || 0 },
366
- });
367
- }
368
- catch (_a) {
369
- showToast(t("messagesFetchFailed"), TOAST_VARIANT.ERROR);
370
- }
371
- })();
372
- }, [dispatch, listParams, workspace === null || workspace === void 0 ? void 0 : workspace.id, showToast, t]);
367
+ if (isDefaultListState) {
368
+ (async () => {
369
+ try {
370
+ const { count, items } = await getCachedWorkspaceUsers({
371
+ params: listParams,
372
+ });
373
+ dispatch({
374
+ type: WORKSPACE_USER_ACTION_TYPES.SET_ITEMS,
375
+ payload: { items: items || [], count: count || 0 },
376
+ });
377
+ }
378
+ catch (_a) {
379
+ showToast(t("messagesFetchFailed"), TOAST_VARIANT.ERROR);
380
+ }
381
+ })();
382
+ return;
383
+ }
384
+ (_a = listFetchNowRef.current) === null || _a === void 0 ? void 0 : _a.call(listFetchNowRef);
385
+ }, [dispatch, isDefaultListState, listParams, workspace === null || workspace === void 0 ? void 0 : workspace.id, showToast, t]);
373
386
  // ============================================================================
374
387
  // 1.4.10 RETURN
375
388
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.1.78",
3
+ "version": "0.1.80",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",