Skip to content

Commit 460bcce

Browse files
[ADV-186] Fix full page reload on navigation causes poor UX (#948)
1 parent 0d2db6e commit 460bcce

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

docs/.vuepress/client.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import "iconify-icon";
22
import {onMounted} from "vue";
3-
import type {RouteLocationNormalized} from "vue-router";
4-
import {defineClientConfig, useRoute} from 'vuepress/client';
3+
import type {RouteLocation, RouteLocationNormalized} from "vue-router";
4+
import {defineClientConfig} from 'vuepress/client';
55
import CloudBanner from "./components/CloudBanner.vue";
66
import ClientsGrid from "./components/ClientsGrid.vue";
77
import KapaWidget from './components/KapaWidget.vue';
@@ -50,14 +50,6 @@ const findEsMeta = (route: RouteLocationNormalized) => {
5050

5151
const removeHtml = (path: string) => path.replace(".html", "");
5252

53-
const reload = () => {
54-
if (typeof window !== "undefined") {
55-
setTimeout(() => {
56-
window.location.reload()
57-
}, 200);
58-
}
59-
}
60-
6153
let cookiebotListenerRegistered = false;
6254

6355

@@ -143,18 +135,12 @@ export default defineClientConfig({
143135
app.component("KapaWidget", KapaWidget);
144136
app.component("UserFeedback", UserFeedback);
145137
const addFixedRoute = (from: string, to: string) => router.addRoute({
146-
path: from, redirect: _ => {
147-
reload();
148-
return to;
149-
}
138+
path: from, redirect: to
150139
});
151-
const addDynamicRoute = (from: string, calc: ((to: RouteLocationNormalized) => string)) =>
140+
const addDynamicRoute = (from: string, calc: ((to: RouteLocation) => string)) =>
152141
router.addRoute({
153142
path: from,
154-
redirect: to => {
155-
reload();
156-
return calc(to);
157-
}
143+
redirect: to => calc(to)
158144
});
159145

160146
// Router configuration

0 commit comments

Comments
 (0)