Skip to content

Commit 27715b2

Browse files
authored
Fix #11406 Pending changes prompt shows up after save as (#11407) (#11411)
1 parent ca30362 commit 27715b2

2 files changed

Lines changed: 4 additions & 22 deletions

File tree

web/client/plugins/ResourcesCatalog/SaveAs.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Persistence from '../../api/persistence';
1616
import { setSelectedResource } from './actions/resources';
1717
import { mapSaveError, mapSaved, mapInfoLoaded, configureMap } from '../../actions/config';
1818
import { userSelector } from '../../selectors/security';
19-
import { push } from 'connected-react-router';
19+
import { replace } from 'connected-react-router';
2020
import { parseResourceProperties, parseClonedResourcePayload } from '../../utils/GeostoreUtils';
2121
import { getResourceInfo } from '../../utils/ResourcesUtils';
2222
import { storySaved, geostoryLoaded, setResource as setGeoStoryResource, setCurrentStory, saveGeoStoryError } from '../../actions/geostory';
@@ -40,7 +40,7 @@ function SaveAs({
4040
onSuccess,
4141
onError,
4242
user,
43-
onPush,
43+
onReplace,
4444
onNotification,
4545
component,
4646
menuItem
@@ -79,7 +79,7 @@ function SaveAs({
7979
setName('');
8080
const { viewerPath } = getResourceInfo(resource);
8181
if (viewerPath) {
82-
onPush(viewerPath);
82+
onReplace(viewerPath);
8383
}
8484
})
8585
.catch((error) => {
@@ -159,7 +159,7 @@ const saveAsConnect = connect(
159159
}),
160160
{
161161
onNotification: show,
162-
onPush: push,
162+
onReplace: replace,
163163
onSelect: setSelectedResource,
164164
onSuccess: (resourceType, resource, data) => {
165165
return (dispatch) => {

web/client/plugins/ResourcesCatalog/containers/PendingStatePrompt.jsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,6 @@ function PendingStatePrompt({
4545
};
4646
}, []);
4747

48-
// disable the back button when there are pending changes
49-
useEffect(() => {
50-
let popState;
51-
if (pendingStateProp) {
52-
popState = () => {
53-
window.history.go(1);
54-
};
55-
window.history.pushState(null, null, window.location.href);
56-
window.addEventListener('popstate', popState);
57-
}
58-
return () => {
59-
if (popState) {
60-
window.removeEventListener('popstate', popState);
61-
popState = undefined;
62-
}
63-
};
64-
}, [pendingStateProp]);
65-
6648
function handleCancel() {
6749
setShowModal(false);
6850
}

0 commit comments

Comments
 (0)