@appcorp/fusion-storybook 0.2.38 → 0.2.39

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.
@@ -25,7 +25,6 @@ import { formatNumber } from "@react-pakistan/util-functions/general/format-numb
25
25
  import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
26
26
  import { CAMPUS_API_ROUTES, pageLimit } from "./constants";
27
27
  import { campusFormValidation } from "./validate";
28
- import { getCachedCampuses, invalidateCampusesCache } from "./cache";
29
28
  import { getCachedWorkspaceSync } from "../workspace/cache";
30
29
  // ============================================================================
31
30
  // 1.1 DRAWER TYPES
@@ -192,7 +191,7 @@ export const useCampusModule = () => {
192
191
  }
193
192
  if (data) {
194
193
  const isCreated = isCreatedOrUpdated(data);
195
- invalidateCampusesCache();
194
+ // invalidateCampusesCache();
196
195
  showToast(isCreated ? t("messagesCreateSuccess") : t("messagesSaveSuccess"), TOAST_VARIANT.SUCCESS);
197
196
  resetFormAndCloseDrawer();
198
197
  (_a = listFetchNowRef.current) === null || _a === void 0 ? void 0 : _a.call(listFetchNowRef);
@@ -220,7 +219,7 @@ export const useCampusModule = () => {
220
219
  return;
221
220
  }
222
221
  if (data) {
223
- invalidateCampusesCache();
222
+ // invalidateCampusesCache();
224
223
  showToast(t("messagesDeleteSuccess"), TOAST_VARIANT.SUCCESS);
225
224
  (_a = listFetchNowRef.current) === null || _a === void 0 ? void 0 : _a.call(listFetchNowRef);
226
225
  }
@@ -243,7 +242,6 @@ export const useCampusModule = () => {
243
242
  updateParams,
244
243
  headers: {
245
244
  "Content-Type": "application/json",
246
- // "x-api-token": process.env.NEXT_PUBLIC_API_KEY!,
247
245
  },
248
246
  });
249
247
  // ============================================================================
@@ -450,41 +448,39 @@ export const useCampusModule = () => {
450
448
  // Keep the latest fetch function in a ref so the fetch effect can call it
451
449
  // without depending on listFetchNow's unstable identity.
452
450
  useEffect(() => {
453
- listFetchNowRef.current = listFetchNow;
454
- });
451
+ listFetchNow();
452
+ // eslint-disable-next-line react-hooks/exhaustive-deps
453
+ }, [listParams]);
455
454
  // Initial load via cache; re-fetch directly from API on page/pageLimit/filter/search changes.
456
- useEffect(() => {
457
- var _a;
458
- if (!schoolId)
459
- return;
460
- const currentPage = Number(listParams.currentPage) || 1;
461
- const currentPageLimit = Number(listParams.pageLimit) || pageLimit;
462
- const isDefaultLoad = currentPage === 1 &&
463
- currentPageLimit === pageLimit &&
464
- !listParams.searchQuery &&
465
- listParams.filterEnabled === undefined;
466
- if (isDefaultLoad) {
467
- (async () => {
468
- try {
469
- const { count, items } = await getCachedCampuses({
470
- params: listParams,
471
- });
472
- dispatch({
473
- type: CAMPUS_ACTION_TYPES.SET_ITEMS,
474
- payload: { items: items || [], count: count || 0 },
475
- });
476
- }
477
- catch (_a) {
478
- showToast(t("messagesFetchFailed"), TOAST_VARIANT.ERROR);
479
- }
480
- })();
481
- }
482
- else {
483
- // Bypass cache for pagination, pageLimit, filter and search changes.
484
- // Use ref to avoid the infinite-loop caused by listFetchNow's unstable identity.
485
- (_a = listFetchNowRef.current) === null || _a === void 0 ? void 0 : _a.call(listFetchNowRef);
486
- }
487
- }, [dispatch, listParams, schoolId, showToast, t]);
455
+ // useEffect(() => {
456
+ // if (!schoolId) return;
457
+ // const currentPage = Number(listParams.currentPage) || 1;
458
+ // const currentPageLimit = Number(listParams.pageLimit) || pageLimit;
459
+ // const isDefaultLoad =
460
+ // currentPage === 1 &&
461
+ // currentPageLimit === pageLimit &&
462
+ // !listParams.searchQuery &&
463
+ // listParams.filterEnabled === undefined;
464
+ // if (isDefaultLoad) {
465
+ // (async () => {
466
+ // try {
467
+ // const { count, items } = await getCachedCampuses({
468
+ // params: listParams,
469
+ // });
470
+ // dispatch({
471
+ // type: CAMPUS_ACTION_TYPES.SET_ITEMS,
472
+ // payload: { items: items || [], count: count || 0 },
473
+ // });
474
+ // } catch {
475
+ // showToast(t("messagesFetchFailed"), TOAST_VARIANT.ERROR);
476
+ // }
477
+ // })();
478
+ // } else {
479
+ // // Bypass cache for pagination, pageLimit, filter and search changes.
480
+ // // Use ref to avoid the infinite-loop caused by listFetchNow's unstable identity.
481
+ // listFetchNowRef.current?.();
482
+ // }
483
+ // }, [dispatch, listParams, schoolId, showToast, t]);
488
484
  // ============================================================================
489
485
  // 1.4.10 RETURN
490
486
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.2.38",
3
+ "version": "0.2.39",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",