Files
speckle-server/packages/frontend-2/utils/globals.ts
T
Kristaps Fabians Geikins 843606775c feat(fe2): parallel middlewares (#5314)
* parallel middlewares foundation + hydration mismatch

* moved to fully parallel middlewares

* a bit less hacky

* some more cleanup

* improved nuxt 4 error formatting

* make parallel middlewares toggleable
2025-08-27 12:38:04 +03:00

47 lines
1.4 KiB
TypeScript

import type { RouteLocationNormalized } from 'vue-router'
import { noop } from 'lodash-es'
import { wrapRefWithTracking } from '~/lib/common/helpers/debugging'
import { ToastNotificationType } from '~~/lib/common/composables/toast'
import {
convertThrowIntoFetchResult,
getCacheId,
getFirstErrorMessage as getFirstGqlErrorMessage,
iterateObjectField,
modifyObjectField,
ROOT_MUTATION,
ROOT_QUERY,
ROOT_SUBSCRIPTION
} from '~/lib/common/helpers/graphql'
import { checkIfIsInPlaceNavigation } from '~/lib/common/helpers/navigation'
import { ViewerEventBusKeys } from '~/lib/viewer/helpers/eventBus'
import { defineParallelizedNuxtRouteMiddleware } from '~/lib/core/helpers/middleware'
/**
* Debugging helper to ensure variables are available in debugging scope
*/
export const markUsed = noop
/**
* Will attempt to resolve the current route definition in various ways.
*/
export const getRouteDefinition = (route?: RouteLocationNormalized) => {
const matchedPath = route ? route.matched[route.matched.length - 1]?.path : undefined
return matchedPath || '/404'
}
export {
ToastNotificationType,
wrapRefWithTracking,
noop,
convertThrowIntoFetchResult,
getFirstGqlErrorMessage,
modifyObjectField,
iterateObjectField,
getCacheId,
checkIfIsInPlaceNavigation,
ROOT_QUERY,
ROOT_MUTATION,
ROOT_SUBSCRIPTION,
ViewerEventBusKeys,
defineParallelizedNuxtRouteMiddleware
}