Skip to content

Commit 46503c5

Browse files
fix(formbuilder): remove double prompt when existing formbuilder with changes DEV-175 DEV-33 (#5800)
### 📣 Summary Formbuilder only uses one method of warning user when leaving with changes made. ### 👀 Preview steps 1. ℹ️ have an account and a project 2. make changes to the project in formbuilder 3. try to navigate out of the formbuilder 4. 🔴 [on main] notice that there are two methods of warning user (DEV-175) 4. 🔴 [on main] notice that the "X" in the alertify modal is colliding with the title (DEV-33) 6. 🟢 [on PR] notice that, by removing the alertify modal, both issues are fixed --------- Co-authored-by: Leszek <[email protected]> Co-authored-by: Leszek Pietrzak <[email protected]>
1 parent 2730a05 commit 46503c5

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

jsapp/js/editorMixins/editableForm.js

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -489,33 +489,13 @@ export default Object.assign(
489489
})
490490
},
491491

492-
// navigating out of form builder
493-
494-
safeNavigateToRoute(route) {
495-
if (this.needsSave()) {
496-
const dialog = alertify.dialog('confirm')
497-
const opts = {
498-
title: UNSAVED_CHANGES_WARNING,
499-
message: '',
500-
labels: { ok: t('Yes, leave form'), cancel: t('Cancel') },
501-
onok: () => {
502-
this.props.router.navigate(route)
503-
},
504-
oncancel: dialog.destroy,
505-
}
506-
dialog.set(opts).show()
507-
} else {
508-
this.props.router.navigate(route)
509-
}
510-
},
511-
512492
safeNavigateToList() {
513493
if (this.state.backRoute) {
514-
this.safeNavigateToRoute(this.state.backRoute)
494+
this.props.router.navigate(this.state.backRoute)
515495
} else if (this.props.router.location.pathname.startsWith(ROUTES.LIBRARY)) {
516-
this.safeNavigateToRoute(ROUTES.LIBRARY)
496+
this.props.router.navigate(ROUTES.LIBRARY)
517497
} else {
518-
this.safeNavigateToRoute(ROUTES.FORMS)
498+
this.props.router.navigate(ROUTES.FORMS)
519499
}
520500
},
521501

@@ -529,7 +509,7 @@ export default Object.assign(
529509
targetRoute = ROUTES.LIBRARY_ITEM.replace(':uid', this.state.asset_uid)
530510
}
531511
}
532-
this.safeNavigateToRoute(targetRoute)
512+
this.props.router.navigate(targetRoute)
533513
},
534514

535515
isAddingQuestionsRestricted() {

0 commit comments

Comments
 (0)