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