Fix: Stop page DSL updates in view mode. (#5843)
This commit is contained in:
parent
fd612829a2
commit
ccf017be12
|
|
@ -90,6 +90,7 @@ import * as Sentry from "@sentry/react";
|
|||
import { ERROR_CODES } from "constants/ApiConstants";
|
||||
import AnalyticsUtil from "utils/AnalyticsUtil";
|
||||
import DEFAULT_TEMPLATE from "templates/default";
|
||||
import { getAppMode } from "selectors/applicationSelectors";
|
||||
|
||||
const getWidgetName = (state: AppState, widgetId: string) =>
|
||||
state.entities.canvasWidgets[widgetId];
|
||||
|
|
@ -441,7 +442,10 @@ function getLayoutSavePayload(
|
|||
|
||||
export function* saveLayoutSaga(action: ReduxAction<{ isRetry?: boolean }>) {
|
||||
try {
|
||||
yield put(saveLayout(action.payload.isRetry));
|
||||
const appMode: APP_MODE | undefined = yield select(getAppMode);
|
||||
if (appMode === APP_MODE.EDIT) {
|
||||
yield put(saveLayout(action.payload.isRetry));
|
||||
}
|
||||
} catch (error) {
|
||||
yield put({
|
||||
type: ReduxActionErrorTypes.SAVE_PAGE_ERROR,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
import { updateWidget } from "actions/pageActions";
|
||||
import { WidgetTypes } from "constants/WidgetConstants";
|
||||
import {
|
||||
MAIN_CONTAINER_WIDGET_ID,
|
||||
WidgetTypes,
|
||||
} from "constants/WidgetConstants";
|
||||
import { useEffect } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { AppState } from "reducers";
|
||||
import { APP_MODE } from "reducers/entityReducers/appReducer";
|
||||
import { getWidget } from "sagas/selectors";
|
||||
import { getAppMode } from "selectors/applicationSelectors";
|
||||
import { useSelector } from "store";
|
||||
import { WidgetOperations } from "widgets/BaseWidget";
|
||||
|
||||
|
|
@ -13,12 +18,14 @@ export const useCanvasMinHeightUpdateHook = (
|
|||
) => {
|
||||
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 (
|
||||
widget &&
|
||||
widget.type === WidgetTypes.CANVAS_WIDGET &&
|
||||
widget.minHeight !== minHeight
|
||||
) {
|
||||
if (canUpdateWidgetMinHeight && widget.minHeight !== minHeight) {
|
||||
dispatch(
|
||||
updateWidget(WidgetOperations.UPDATE_PROPERTY, widgetId, {
|
||||
propertyPath: "minHeight",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user