Skip to content

Commit 33690f9

Browse files
committed
Replace sliceFormData with the initial form data
1 parent ed6e5f9 commit 33690f9

File tree

1 file changed

+3
-2
lines changed
  • superset-frontend/src/explore/components/ExploreViewContainer

1 file changed

+3
-2
lines changed

superset-frontend/src/explore/components/ExploreViewContainer/index.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ function ExploreViewContainer(props) {
252252
const theme = useTheme();
253253

254254
const isBeforeUnloadActive = useRef(false);
255+
const initialFormData = useRef(props.form_data);
255256

256257
const defaultSidebarsWidth = {
257258
controls_width: 320,
@@ -384,7 +385,7 @@ function ExploreViewContainer(props) {
384385

385386
useEffect(() => {
386387
const formDataChanged = !isEmpty(
387-
getFormDataDiffs(props.chart.sliceFormData, props.form_data),
388+
getFormDataDiffs(initialFormData.current, props.form_data),
388389
);
389390
if (formDataChanged && !isBeforeUnloadActive.current) {
390391
window.addEventListener('beforeunload', handleUnloadEvent);
@@ -394,7 +395,7 @@ function ExploreViewContainer(props) {
394395
window.removeEventListener('beforeunload', handleUnloadEvent);
395396
isBeforeUnloadActive.current = false;
396397
}
397-
}, [props.chart.sliceFormData, props.form_data]);
398+
}, [props.form_data]);
398399

399400
// cleanup beforeunload event listener
400401
// we use separate useEffect to call it only on component unmount instead of on every form data change

0 commit comments

Comments
 (0)