Fix container widget dynamicBindingPathList correction (#3619)
This commit is contained in:
parent
a82c789c1a
commit
64116583e3
|
|
@ -365,7 +365,7 @@ function* savePageSaga(action: ReduxAction<{ isRetry?: boolean }>) {
|
||||||
if (error instanceof IncorrectBindingError) {
|
if (error instanceof IncorrectBindingError) {
|
||||||
const { isRetry } = action.payload;
|
const { isRetry } = action.payload;
|
||||||
const incorrectBindingError = JSON.parse(error.message);
|
const incorrectBindingError = JSON.parse(error.message);
|
||||||
const { widgetId, message } = incorrectBindingError;
|
const { message } = incorrectBindingError;
|
||||||
if (isRetry) {
|
if (isRetry) {
|
||||||
Sentry.captureException(new Error("Failed to correct binding paths"));
|
Sentry.captureException(new Error("Failed to correct binding paths"));
|
||||||
yield put({
|
yield put({
|
||||||
|
|
@ -379,18 +379,23 @@ function* savePageSaga(action: ReduxAction<{ isRetry?: boolean }>) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const correctedWidget = migrateIncorrectDynamicBindingPathLists(
|
// Create a denormalized structure because the migration needs the children in the dsl form
|
||||||
widgets[widgetId],
|
const denormalizedWidgets = CanvasWidgetsNormalizer.denormalize("0", {
|
||||||
|
canvasWidgets: widgets,
|
||||||
|
});
|
||||||
|
const correctedWidgets = migrateIncorrectDynamicBindingPathLists(
|
||||||
|
denormalizedWidgets,
|
||||||
|
);
|
||||||
|
// Normalize the widgets because the save page needs it in the flat structure
|
||||||
|
const normalizedWidgets = CanvasWidgetsNormalizer.normalize(
|
||||||
|
correctedWidgets,
|
||||||
);
|
);
|
||||||
AnalyticsUtil.logEvent("CORRECT_BAD_BINDING", {
|
AnalyticsUtil.logEvent("CORRECT_BAD_BINDING", {
|
||||||
error: error.message,
|
error: error.message,
|
||||||
correctWidget: JSON.stringify(correctedWidget),
|
correctWidget: JSON.stringify(normalizedWidgets),
|
||||||
});
|
});
|
||||||
yield put(
|
yield put(
|
||||||
updateAndSaveLayout(
|
updateAndSaveLayout(normalizedWidgets.entities.canvasWidgets, true),
|
||||||
{ ...widgets, [widgetId]: correctedWidget },
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user