SophistSolutions / WhyTheFuckIsMyNetworkSoSlow

WhyTheFuckIsMyNetworkSoSlow is a network performance analysis tool, making it easy to quickly examine a network and see what is wrong, and to evaluate longer term trends.
15 stars 1 forks source link

auto-redirect of page with query params should be doable from router. #14

Open LewisPringle opened 3 years ago

LewisPringle commented 3 years ago

IN Devices.vue: private created() { // @see https://github.com/SophistSolutions/WhyTheFuckIsMyNetworkSoSlow/issues/14 // This works, but maybe cleaner to do within the router, but wasn't able to get // working (so far) if (this.$route.query.selectedNetwork) { const s: string = this.$route.query.selectedNetwork as string; this.$router.push({ path: this.$route.path, // params: { selectedNetwork: this.$route.query.selectedNetwork }, }); this.selectedNetworkCurrent = s; }

In router.ts: // @see https://github.com/SophistSolutions/WhyTheFuckIsMyNetworkSoSlow/issues/14 // Cannot get this working but got basically same thing working from created // method // beforeEnter: (to, from, next) => { // // do something with to.query and then save it in store // if (to.query.selectedNetwork) { // next({ // path: "/devices", // replace: true, // params: { selectedNetwork: to.query.selectedNetwork }, // }); // } else { // next(); // } // }, // props: (route) => ({ selectedNetwork: route.query.selectedNetwork }),

LewisPringle commented 3 years ago

NOTE: ANOTHER bug with this current mechanism is that the 'selectedNetwork=' item shows up in history (and doesnt behave well when you go back) - I thiought push was suppsoed to not do that but maybe I have to call replace with some parameter saying no navigate)?

LewisPringle commented 3 years ago

nevermind about last point - fixed by using replace instead of push.But still want to fix issue with moving this to router rules.