@@ -211,9 +211,7 @@ import { allBrowsersIcons } from '@packages/frontend-shared/src/assets/browserLo
211
211
import { gql , useMutation } from ' @urql/vue'
212
212
import { TopNavFragment , TopNav_LaunchOpenProjectDocument , TopNav_SetBrowserDocument } from ' ../../generated/graphql'
213
213
import { useI18n } from ' @cy/i18n'
214
- import { computed , ref } from ' vue'
215
- // eslint-disable-next-line no-duplicate-imports
216
- import type { Ref } from ' vue'
214
+ import { computed , ref , Ref } from ' vue'
217
215
const { t } = useI18n ()
218
216
import { onClickOutside , onKeyStroke , useTimeAgo } from ' @vueuse/core'
219
217
import DocsMenuContent from ' ./DocsMenuContent.vue'
@@ -284,34 +282,43 @@ const props = defineProps<{
284
282
showBrowsers? : boolean
285
283
}>()
286
284
287
- const docsMenuVariant: Ref <' main' | ' orchestration' | ' ci' > = ref (' main' )
288
-
289
- const promptsEl: Ref <HTMLElement | null > = ref (null )
290
-
291
- // reset docs menu if click or keyboard navigation happens outside
292
- // so it doesn't reopen on the one of the prompts
293
-
294
- const versions = computed (() => {
285
+ const versions = (() => {
295
286
if (! props .gql .versions ) {
296
- return null
287
+ return ref ( null )
297
288
}
298
289
299
- return {
300
- current: {
301
- released: useTimeAgo (new Date (props .gql .versions .current .released )).value ,
302
- version: props .gql .versions .current .version ,
303
- },
304
- latest: {
305
- released: useTimeAgo (new Date (props .gql .versions .latest .released )).value ,
306
- version: props .gql .versions .latest .version ,
307
- },
308
- }
309
- })
290
+ const currentReleased = useTimeAgo (new Date (props .gql .versions .current .released ))
291
+ const latestReleased = useTimeAgo (new Date (props .gql .versions .latest .released ))
292
+
293
+ return computed (() => {
294
+ if (! props .gql .versions ) {
295
+ return null
296
+ }
297
+
298
+ return {
299
+ current: {
300
+ released: currentReleased .value ,
301
+ version: props .gql .versions .current .version ,
302
+ },
303
+ latest: {
304
+ released: latestReleased .value ,
305
+ version: props .gql .versions .latest .version ,
306
+ },
307
+ }
308
+ })
309
+ })()
310
310
311
311
const runningOldVersion = computed (() => {
312
312
return props .gql .versions ? props .gql .versions .current .released < props .gql .versions .latest .released : false
313
313
})
314
314
315
+ const docsMenuVariant: Ref <' main' | ' orchestration' | ' ci' > = ref (' main' )
316
+
317
+ const promptsEl: Ref <HTMLElement | null > = ref (null )
318
+
319
+ // reset docs menu if click or keyboard navigation happens outside
320
+ // so it doesn't reopen on the one of the prompts
321
+
315
322
onClickOutside (promptsEl , () => {
316
323
setTimeout (() => {
317
324
// reset the content of the menu when
0 commit comments