## Description > Code splitting FE files to support app level invites on Business edition. Fixes [#21018](https://github.com/appsmithorg/appsmith/issues/21018) [#21015](https://github.com/appsmithorg/appsmith/issues/21015) ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? > Nothing is affected on CE by this change. - Manual ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";
|
|
import { useEffect } from "react";
|
|
import { useDispatch } from "react-redux";
|
|
import type { AppState } from "@appsmith/reducers";
|
|
import { APP_MODE } from "entities/App";
|
|
import { getWidget } from "sagas/selectors";
|
|
import { getAppMode } from "@appsmith/selectors/applicationSelectors";
|
|
import { useSelector } from "react-redux";
|
|
import { updateWidgetMetaPropAndEval } from "actions/metaActions";
|
|
import WidgetFactory from "utils/WidgetFactory";
|
|
|
|
const WidgetTypes = WidgetFactory.widgetTypes;
|
|
|
|
export const useCanvasMinHeightUpdateHook = (
|
|
widgetId: string,
|
|
minHeight = 0,
|
|
) => {
|
|
const widget = useSelector((state: AppState) => getWidget(state, widgetId));
|
|
const dispatch = useDispatch();
|
|
const appMode = useSelector(getAppMode);
|
|
const canUpdateWidgetMinHeight =
|
|
appMode === APP_MODE.EDIT &&
|
|
widgetId !== MAIN_CONTAINER_WIDGET_ID &&
|
|
widget &&
|
|
widget.type === WidgetTypes.CANVAS_WIDGET;
|
|
useEffect(() => {
|
|
if (canUpdateWidgetMinHeight && widget.minHeight !== minHeight) {
|
|
dispatch(updateWidgetMetaPropAndEval(widgetId, "minHeight", minHeight));
|
|
}
|
|
}, [minHeight]);
|
|
};
|