@appcorp/fusion-storybook 0.1.101 → 0.2.0

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.
@@ -52,7 +52,7 @@ const createComponentInstances = () => ({
52
52
  moreActions: _jsx(AdmissionMoreActions, {}),
53
53
  view: _jsx(AdmissionView, {}),
54
54
  });
55
- const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, labelActions, labelClass, labelEnabled, labelFirstName, labelId, labelLastName, labelRegistrationCode, labelStatus, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
55
+ const createAdmissionConfig = ({ cancelLabel, dispatch, drawerTitle, labelActions, labelClass, labelEnabled, labelFirstName, labelId, labelLastName, labelRegistrationCode, labelStatus, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
56
56
  const components = createComponentInstances();
57
57
  return {
58
58
  moduleName: "admission",
@@ -76,7 +76,7 @@ const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, lab
76
76
  tableDescription,
77
77
  tableTitle,
78
78
  viewContent: components.view,
79
- size: drawer === ADMISSION_DRAWER.FORM_DRAWER ? "full" : "small",
79
+ size: "small",
80
80
  onClearFilters: () => {
81
81
  dispatch({ type: ADMISSION_ACTION_TYPES.RESET_FORM });
82
82
  },
@@ -88,10 +88,12 @@ const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, lab
88
88
  const GenericAdmissionPage = createGenericModulePage();
89
89
  const AdmissionPageInner = (props) => {
90
90
  const context = useAdmissionModule();
91
- // Memoize config creation - destructure props to avoid object reference changes
91
+ // Memoize config creation - INTENTIONALLY EXCLUDE drawer state to prevent infinite loops
92
+ // The drawer state changing (from clicking buttons) would recreate this config,
93
+ // causing unnecessary re-renders and state updates. Since config should be stable
94
+ // across drawer state changes, we exclude it from dependencies.
92
95
  const admissionConfig = useMemo(() => createAdmissionConfig({
93
96
  dispatch: context.dispatch,
94
- drawer: context.state.drawer,
95
97
  cancelLabel: props.cancelLabel,
96
98
  drawerTitle: props.drawerTitle,
97
99
  labelActions: props.labelActions,
@@ -108,7 +110,6 @@ const AdmissionPageInner = (props) => {
108
110
  tableTitle: props.tableTitle,
109
111
  }), [
110
112
  context.dispatch,
111
- context.state.drawer,
112
113
  props.cancelLabel,
113
114
  props.drawerTitle,
114
115
  props.labelActions,
@@ -124,6 +125,11 @@ const AdmissionPageInner = (props) => {
124
125
  props.tableDescription,
125
126
  props.tableTitle,
126
127
  ]);
128
+ // Dynamically apply drawer size to config for proper drawer sizing
129
+ // This allows size to change without recreating the entire config
130
+ const admissionConfigWithSize = useMemo(() => (Object.assign(Object.assign({}, admissionConfig), { size: context.state.drawer === ADMISSION_DRAWER.FORM_DRAWER
131
+ ? "full"
132
+ : "small" })), [admissionConfig, context.state.drawer]);
127
133
  const hasPermission = resolveRbacPermissions({
128
134
  userRole: props.userRole,
129
135
  moduleName: "Admission",
@@ -131,7 +137,7 @@ const AdmissionPageInner = (props) => {
131
137
  if (!hasPermission) {
132
138
  return _jsx(RbacNoAccess, { moduleName: "Admission" });
133
139
  }
134
- return (_jsx("div", { className: "p-4", children: _jsx(GenericAdmissionPage, { overrideConfig: admissionConfig, context: context, tableBodyCols: tableBodyCols }) }));
140
+ return (_jsx("div", { className: "p-4", children: _jsx(GenericAdmissionPage, { overrideConfig: admissionConfigWithSize, context: context, tableBodyCols: tableBodyCols }) }));
135
141
  };
136
142
  // ============================================================================
137
143
  // PAGE EXPORTS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.1.101",
3
+ "version": "0.2.0",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",