Skip to content
Snippets Groups Projects
Unverified Commit fd17c05a authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix saving of existing quesiton. Resolves #4695

parent 80f4b6d1
No related branches found
No related tags found
No related merge requests found
......@@ -41,13 +41,22 @@ export default (ComposedComponent) => class extends Component {
// if the state previously was the saved one and is now not, then we probably
// hit the back button, so close the wrapped component
if (location.state === this._state && nextLocation.state !== this._state) {
this.props.onClose();
// close in a timeout in case it will be closed anyway and the URL changes.
// alternatively may be able to tighten up the logic above
this._timeout = setTimeout(() => {
this.props.onClose();
}, 100);
}
}
componentWillUnmount() {
const location = this.props._routeless_location;
const goBack = this.props._routeless_goBack;
if (this._timeout != null) {
clearTimeout(this._timeout);
}
// if we unmount (e.x. hit the close button which calls onClose directly) and still have the
// same state then go back to the original state
// NOTE: ideally we would remove the current state from the history so the forward
......
......@@ -444,7 +444,7 @@ export const notifyCardCreatedFn = createThunkAction(NOTIFY_CARD_CREATED, (card)
});
export const NOTIFY_CARD_UPDATED = "metabase/qb/NOTIFY_CARD_UPDATED";
export const notifyCardUpdatedFn = createThunkAction("NOTIFY_CARD_UPDATED", (card) => {
export const notifyCardUpdatedFn = createThunkAction(NOTIFY_CARD_UPDATED, (card) => {
return (dispatch, getState) => {
dispatch(updateUrl(card, { dirty: false }));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment