From 0c0665ff034c02fb63b798905dfb334df9a4bf24 Mon Sep 17 00:00:00 2001 From: Nishan Baral Date: Sun, 3 Dec 2023 23:05:05 +0900 Subject: [PATCH] Issue 645 naviagtion duplicated bug fixed --- src/views/Countries.vue | 20 ++++++++++---------- src/views/Networks.vue | 17 +++++++++-------- src/views/ROV.vue | 20 ++++++++++---------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/views/Countries.vue b/src/views/Countries.vue index 5ad42a53..a2e95a25 100644 --- a/src/views/Countries.vue +++ b/src/views/Countries.vue @@ -199,16 +199,16 @@ export default { }, methods: { pushRoute() { - this.$router.replace({ - //this.$router.replace({ query: Object.assign({}, this.$route.query, { hege_dt: clickData.points[0].x, hege_tb: table }) }); - query: Object.assign({}, this.$route.query, { - af: this.family, - last: this.interval.dayDiff(), - date: this.$options.filters.ihrUtcString(this.interval.end, false), - }), - }) - this.loadingStatus = LOADING_STATUS.LOADED - this.fetch = true + const currentQuery = { + af: String(this.family), + last: String(this.interval.dayDiff()), + date: this.$options.filters.ihrUtcString(this.interval.end, false), + }; + if ( JSON.stringify(currentQuery) !== JSON.stringify(this.$route.query)) { + this.$router.replace({ query: currentQuery, hash: this.$route.hash }); + this.loadingStatus = LOADING_STATUS.LOADED + this.fetch = true + } }, displayNetDelay(displayValue) { this.show.net_delay = displayValue diff --git a/src/views/Networks.vue b/src/views/Networks.vue index 6aa308d2..4f5d1063 100644 --- a/src/views/Networks.vue +++ b/src/views/Networks.vue @@ -284,14 +284,15 @@ export default { }, methods: { pushRoute() { - this.$router.replace({ - //this.$router.replace({ query: Object.assign({}, this.$route.query, { hege_dt: clickData.points[0].x, hege_tb: table }) }); - query: Object.assign({}, this.$route.query, { - af: this.family, - last: this.interval.dayDiff(), - date: this.$options.filters.ihrUtcString(this.interval.end, false), - }), - }) + const currentQuery = { + af: String(this.family), + last: String(this.interval.dayDiff()), + date: this.$options.filters.ihrUtcString(this.interval.end, false), + }; + + if ( JSON.stringify(currentQuery) !== JSON.stringify(this.$route.query)) { + this.$router.replace({ query: currentQuery, hash: this.$route.hash }); + } }, netName() { let filter = new NetworkQuery().asNumber(this.asNumber) diff --git a/src/views/ROV.vue b/src/views/ROV.vue index dc3e29ac..5c14faca 100644 --- a/src/views/ROV.vue +++ b/src/views/ROV.vue @@ -62,16 +62,16 @@ export default { }, methods: { pushRoute() { - this.$router.replace({ - //this.$router.replace({ query: Object.assign({}, this.$route.query, { hege_dt: clickData.points[0].x, hege_tb: table }) }); - query: Object.assign({}, this.$route.query, { - af: this.family, - last: this.interval.dayDiff(), - date: this.$options.filters.ihrUtcString(this.interval.end, false), - }), - }) - this.loadingStatus = LOADING_STATUS.LOADED - this.fetch = true + const currentQuery = { + af: String(this.family), + last: String(this.interval.dayDiff()), + date: this.$options.filters.ihrUtcString(this.interval.end, false), + }; + if ( JSON.stringify(currentQuery) !== JSON.stringify(this.$route.query)) { + this.$router.replace({ query: currentQuery, hash: this.$route.hash }); + this.loadingStatus = LOADING_STATUS.LOADED + this.fetch = true + } }, displayNetDelay(displayValue) { this.show.net_delay = displayValue