1515
1616<script setup lang="ts">
1717import router from ' @/router'
18- import { ref , watch } from ' vue'
18+ import { nextTick , ref , watch } from ' vue'
1919import { ipc , store , track } from ' ./electron'
2020import { useAppStore } from ' ./store/app'
2121import { repository } from ' ../../package.json'
@@ -28,6 +28,7 @@ import {
2828 emitter
2929} from ' @/composable'
3030import { createToast , destroyAllToasts } from ' vercel-toast'
31+ import { useRoute } from ' vue-router'
3132
3233// По какой то причине необходимо явно установить роут в '/'
3334// для корректного поведения в продакшен сборке
@@ -36,6 +37,7 @@ router.push('/')
3637
3738const appStore = useAppStore ()
3839const snippetStore = useSnippetStore ()
40+ const route = useRoute ()
3941
4042const isUpdateAvailable = ref (false )
4143
@@ -127,6 +129,17 @@ watch(
127129 }
128130)
129131
132+ watch (
133+ () => route .path ,
134+ () => {
135+ if (route .path === ' /' ) {
136+ nextTick (() => {
137+ emitter .emit (' scroll-to:snippet' , snippetStore .selectedId ! )
138+ })
139+ }
140+ }
141+ )
142+
130143ipc .on (' main-menu:preferences' , () => {
131144 router .push (' /preferences' )
132145})
0 commit comments