This commit is contained in:
2020-02-28 23:29:08 +00:00
parent 4ada1b62cd
commit f925206470
2 changed files with 19 additions and 10 deletions

View File

@@ -313,6 +313,15 @@ export default {
},
beforeRouteUpdate(to, from, next) {
//fetch the data for the record as if it's a new record
bugbug: if we are here because a recent submit this triggers a full fetch
//except there's no reason to full fetch as we already have the data required from the submit
//so need to flag that somehow or figure out better logic here
//- Only CREATED and beforeRouteUpdate are triggering GetDataFromAPI, created is valid on open of course so need to handle beforerouteupdate
//-Does it really need to even do anything, I mean, why would the route update, I guess when navigating back and forth between widgets?
//WHY IS THIS REQUIRED? IS IT BECAUSE OF NAV BACK AND FORTH BETWEEN WIDGETS MAYBE??
//TEST THAT BEFORE PROCEEDING WITH ANY FIX FOR SUBMIT FETCH ISSUE
if (to.params.recordid != 0) {
this.getDataFromApi(to.params.recordid);
}
@@ -504,8 +513,8 @@ export default {
//change url to new record in history
//NOTE: will not cause a new navigate, almost nothing does unless forced with a KEY property or using router.GO()
//but will trigger navigation guard beforeRouteUpdate which we use here in this form
//to fetch data again
debugger;
//NOTE: THIS IS THE ONLY PLACE ON THIS FORM THAT WILL TRIGGER BEFOREROUTEUPDATE
vm.$router.replace(
vm.$route.fullPath.slice(0, -1) + res.data.id
);