Skip to content

Commit 92707cb

Browse files
committedDec 21, 2024·
Improve isInPage behavior to work better on App.vue hot reload
1 parent c61af99 commit 92707cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/App.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<script setup lang="ts">
22
import { RouterLink, RouterView, useRouter } from 'vue-router';
33
import { waitForInitialSession } from './lib/atproto/signed-in-user';
4-
import { ref, watch } from 'vue';
4+
import { computed, ref, watch } from 'vue';
55
import { useVanillaCss } from './lib/shared-globals';
66
import { frameworkStyles } from './lib/framework-styles';
77
import UsePico from './components/UsePico.vue';
8+
import { watchImmediate } from '@vueuse/core';
89
9-
const isInPage = ref<boolean>();
10+
const isInPage = computed(() => router.currentRoute.value.path.startsWith('/page/'));
1011
const router = useRouter();
1112
12-
watch(router.currentRoute, route => {
13-
isInPage.value = route.path.startsWith('/page/');
13+
watchImmediate(router.currentRoute, () => {
1414
useVanillaCss.value = true;
1515
});
1616

0 commit comments

Comments
 (0)