@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
|
-
|
|
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
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
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
|
// ============================================================================
|