@appcorp/fusion-storybook 0.3.85 → 0.3.87

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.
@@ -6,30 +6,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  * Filter UI for the student-fee list. Supports filterEnabled (radio) and
7
7
  * filterStatus (payment status combobox).
8
8
  *
9
- * NOTE: This component intentionally avoids useStudentFeeModule() because
10
- * that hook creates an independent useModuleEntityV2 instance with its own
11
- * listFetchNow + auto-fetch effect, causing a redundant API call on mount
12
- * (each time the filter drawer opens). We only need state + a simple
13
- * handleChange, which context provides directly.
9
+ * The API provider (StudentFeeApiProvider) manages a single useModuleEntityV2
10
+ * instance shared across all consumers, so calling useStudentFeeModule from
11
+ * child components no longer creates redundant API hooks or auto-fetch effects.
14
12
  */
15
- import { useCallback } from "react";
16
13
  import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
17
14
  import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
18
- import { STUDENT_FEE_ACTION_TYPES, useStudentFeeContext, } from "./context/shared";
15
+ import { useStudentFeeModule } from "./context";
19
16
  import { PAYMENT_STATUS_OPTIONS } from "./constants";
20
17
  import { STUDENT_FEE_API_ROUTES } from "../../constants";
21
18
  import { useTranslations } from "next-intl";
22
19
  export const StudentFeeFilter = () => {
23
- const { state, dispatch } = useStudentFeeContext();
20
+ const { state, handleChange } = useStudentFeeModule();
24
21
  const { filterEnabled, filterStatus } = state;
25
- const handleChange = useCallback((field, value) => {
26
- if (field === "filterEnabled" || field === "filterStatus") {
27
- dispatch({
28
- type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
29
- payload: { key: field, value },
30
- });
31
- }
32
- }, [dispatch]);
33
22
  const t = useTranslations("studentFee");
34
23
  const paymentStatusLabelMap = {
35
24
  PENDING: t("formOptionPending"),
@@ -19,6 +19,7 @@ import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
19
19
  import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
20
20
  import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
21
21
  import { useStudentFeeModule, StudentFeeProvider, STUDENT_FEE_ACTION_TYPES, } from "./context";
22
+ import { StudentFeeApiProvider } from "./context/student-fee-api-provider";
22
23
  import { StudentFeeFilter } from "./filter";
23
24
  import { StudentFeeForm } from "./form";
24
25
  import { StudentFeeMoreActions } from "./more-actions";
@@ -199,4 +200,4 @@ const StudentFeePageInner = (props) => {
199
200
  // ============================================================================
200
201
  // PAGE EXPORTS
201
202
  // ============================================================================
202
- export const StudentFeePage = (props) => (_jsx(StudentFeeProvider, { children: _jsx(StudentFeePageInner, Object.assign({}, props)) }));
203
+ export const StudentFeePage = (props) => (_jsx(StudentFeeProvider, { children: _jsx(StudentFeeApiProvider, { children: _jsx(StudentFeePageInner, Object.assign({}, props)) }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.3.85",
3
+ "version": "0.3.87",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",