Commit a2a3bcbc authored by Stefan Probst's avatar Stefan Probst
Browse files

fix: work around item versions endpoint not handling drafts

parent 0064cb6f
Pipeline #291216 passed with stages
in 10 minutes
......@@ -90,10 +90,13 @@ export function DraftItemSearchResult(props: DraftItemSearchResultProps): JSX.El
{t(['authenticated', 'controls', 'delete'])}
</ButtonLink>
<Link
href={itemRoutes.ItemEditVersionPage(item.category)({
persistentId: item.persistentId,
versionId: item.id,
})}
href={itemRoutes.ItemEditVersionPage(item.category)(
{
persistentId: item.persistentId,
versionId: item.id,
},
{ draft: true },
)}
aria-label={t(['authenticated', 'draft-items', 'edit-item'], {
values: { label: item.label },
})}
......
......@@ -18,7 +18,15 @@ export function ItemLink(props: ItemLinkProps): JSX.Element {
const href =
status === 'approved'
? itemRoutes.ItemPage(category)({ persistentId })
: itemRoutes.ItemVersionPage(category)({ persistentId, versionId })
: itemRoutes.ItemVersionPage(category)(
{
persistentId,
versionId,
},
{
draft: status === 'draft' ? true : undefined,
},
)
return <Link href={href}>{children}</Link>
}
......@@ -22,7 +22,7 @@ import { useDatasetFormFields } from '@/components/item-form/useDatasetFormField
import { useDatasetValidationSchema } from '@/components/item-form/useDatasetValidationSchema'
import { useUpdateItemMeta } from '@/components/item-form/useUpdateItemMeta'
import type { Dataset, DatasetInput } from '@/data/sshoc/api/dataset'
import { useDatasetVersion } from '@/data/sshoc/hooks/dataset'
import { useDataset, useDatasetVersion } from '@/data/sshoc/hooks/dataset'
import type { PageComponent } from '@/lib/core/app/types'
import { FORM_ERROR } from '@/lib/core/form/Form'
import { getLocale } from '@/lib/core/i18n/getLocale'
......@@ -32,6 +32,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Centered } from '@/lib/core/ui/Centered/Centered'
import { FullPage } from '@/lib/core/ui/FullPage/FullPage'
......@@ -46,7 +47,9 @@ export namespace EditDatasetVersionPage {
versionId: Dataset['id']
}
export type PathParams = StringParams<PathParamsInput>
export type SearchParamsInput = Record<string, never>
export interface SearchParamsInput {
draft?: boolean
}
export interface Props extends WithDictionaries<'authenticated' | 'common'> {
params: PathParams
}
......@@ -94,11 +97,23 @@ export default function EditDatasetVersionPage(props: EditDatasetVersionPage.Pro
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _dataset = useDatasetVersion({ persistentId, versionId }, undefined, {
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _dataset = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
useDatasetVersion({ persistentId, versionId }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
: // eslint-disable-next-line react-hooks/rules-of-hooks
useDataset({ persistentId, draft: true }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const dataset = _dataset.data
const category = dataset?.category ?? 'dataset'
......
......@@ -33,7 +33,7 @@ import { ItemSource } from '@/components/item/ItemSource'
import { ItemTitle } from '@/components/item/ItemTitle'
import { ItemVersionScreenLayout } from '@/components/item/ItemVersionScreenLayout'
import type { Dataset } from '@/data/sshoc/api/dataset'
import { useDatasetVersion } from '@/data/sshoc/hooks/dataset'
import { useDataset, useDatasetVersion } from '@/data/sshoc/hooks/dataset'
import type { PageComponent } from '@/lib/core/app/types'
import { getLocale } from '@/lib/core/i18n/getLocale'
import { getLocales } from '@/lib/core/i18n/getLocales'
......@@ -42,6 +42,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Breadcrumbs } from '@/lib/core/ui/Breadcrumbs/Breadcrumbs'
import { Centered } from '@/lib/core/ui/Centered/Centered'
......@@ -55,7 +56,9 @@ export namespace DatasetVersionPage {
versionId: Dataset['id']
}
export type PathParams = StringParams<PathParamsInput>
export type SearchParamsInput = Record<string, never>
export interface SearchParamsInput {
draft?: boolean
}
export interface Props extends WithDictionaries<'authenticated' | 'common'> {
params: PathParams
}
......@@ -98,12 +101,18 @@ export async function getStaticProps(
}
export default function DatasetVersionPage(props: DatasetVersionPage.Props): JSX.Element {
const router = useRouter()
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _dataset = useDatasetVersion({ persistentId, versionId })
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _dataset = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
useDatasetVersion({ persistentId, versionId }, undefined, { enabled: router.isReady })
: // eslint-disable-next-line react-hooks/rules-of-hooks
useDataset({ persistentId, draft: true }, undefined, { enabled: router.isReady })
const dataset = _dataset.data
const router = useRouter()
const { t } = useI18n<'authenticated' | 'common'>()
const category = dataset?.category ?? 'dataset'
......
......@@ -22,7 +22,7 @@ import { usePublicationFormFields } from '@/components/item-form/usePublicationF
import { usePublicationValidationSchema } from '@/components/item-form/usePublicationValidationSchema'
import { useUpdateItemMeta } from '@/components/item-form/useUpdateItemMeta'
import type { Publication, PublicationInput } from '@/data/sshoc/api/publication'
import { usePublicationVersion } from '@/data/sshoc/hooks/publication'
import { usePublication, usePublicationVersion } from '@/data/sshoc/hooks/publication'
import type { PageComponent } from '@/lib/core/app/types'
import { FORM_ERROR } from '@/lib/core/form/Form'
import { getLocale } from '@/lib/core/i18n/getLocale'
......@@ -32,6 +32,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Centered } from '@/lib/core/ui/Centered/Centered'
import { FullPage } from '@/lib/core/ui/FullPage/FullPage'
......@@ -96,11 +97,23 @@ export default function EditPublicationVersionPage(
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _publication = usePublicationVersion({ persistentId, versionId }, undefined, {
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _publication = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
usePublicationVersion({ persistentId, versionId }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
: // eslint-disable-next-line react-hooks/rules-of-hooks
usePublication({ persistentId, draft: true }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const publication = _publication.data
const category = publication?.category ?? 'publication'
......
......@@ -33,7 +33,7 @@ import { ItemVersionScreenLayout } from '@/components/item/ItemVersionScreenLayo
import { PublicationContentContributors } from '@/components/item/PublicationContentContributors'
import { PublicationVersionControls } from '@/components/item/PublicationVersionControls'
import type { Publication } from '@/data/sshoc/api/publication'
import { usePublicationVersion } from '@/data/sshoc/hooks/publication'
import { usePublication, usePublicationVersion } from '@/data/sshoc/hooks/publication'
import type { PageComponent } from '@/lib/core/app/types'
import { getLocale } from '@/lib/core/i18n/getLocale'
import { getLocales } from '@/lib/core/i18n/getLocales'
......@@ -42,6 +42,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Breadcrumbs } from '@/lib/core/ui/Breadcrumbs/Breadcrumbs'
import { Centered } from '@/lib/core/ui/Centered/Centered'
......@@ -98,12 +99,18 @@ export async function getStaticProps(
}
export default function PublicationVersionPage(props: PublicationVersionPage.Props): JSX.Element {
const router = useRouter()
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _publication = usePublicationVersion({ persistentId, versionId })
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _publication = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
usePublicationVersion({ persistentId, versionId }, undefined, { enabled: router.isReady })
: // eslint-disable-next-line react-hooks/rules-of-hooks
usePublication({ persistentId, draft: true }, undefined, { enabled: router.isReady })
const publication = _publication.data
const router = useRouter()
const { t } = useI18n<'authenticated' | 'common'>()
const category = publication?.category ?? 'publication'
......
......@@ -22,7 +22,7 @@ import { useToolFormFields } from '@/components/item-form/useToolFormFields'
import { useToolValidationSchema } from '@/components/item-form/useToolValidationSchema'
import { useUpdateItemMeta } from '@/components/item-form/useUpdateItemMeta'
import type { Tool, ToolInput } from '@/data/sshoc/api/tool-or-service'
import { useToolVersion } from '@/data/sshoc/hooks/tool-or-service'
import { useTool, useToolVersion } from '@/data/sshoc/hooks/tool-or-service'
import type { PageComponent } from '@/lib/core/app/types'
import { FORM_ERROR } from '@/lib/core/form/Form'
import { getLocale } from '@/lib/core/i18n/getLocale'
......@@ -32,6 +32,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Centered } from '@/lib/core/ui/Centered/Centered'
import { FullPage } from '@/lib/core/ui/FullPage/FullPage'
......@@ -96,11 +97,23 @@ export default function EditToolOrServiceVersionPage(
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _tool = useToolVersion({ persistentId, versionId }, undefined, {
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _tool = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
useToolVersion({ persistentId, versionId }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
: // eslint-disable-next-line react-hooks/rules-of-hooks
useTool({ persistentId, draft: true }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const tool = _tool.data
const category = tool?.category ?? 'tool-or-service'
......
......@@ -33,7 +33,7 @@ import { ItemVersionScreenLayout } from '@/components/item/ItemVersionScreenLayo
import { ToolOrServiceContentContributors } from '@/components/item/ToolOrServiceContentContributors'
import { ToolOrServiceVersionControls } from '@/components/item/ToolOrServiceVersionControls'
import type { Tool } from '@/data/sshoc/api/tool-or-service'
import { useToolVersion } from '@/data/sshoc/hooks/tool-or-service'
import { useTool, useToolVersion } from '@/data/sshoc/hooks/tool-or-service'
import type { PageComponent } from '@/lib/core/app/types'
import { getLocale } from '@/lib/core/i18n/getLocale'
import { getLocales } from '@/lib/core/i18n/getLocales'
......@@ -42,6 +42,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Breadcrumbs } from '@/lib/core/ui/Breadcrumbs/Breadcrumbs'
import { Centered } from '@/lib/core/ui/Centered/Centered'
......@@ -100,12 +101,18 @@ export async function getStaticProps(
export default function ToolOrServiceVersionPage(
props: ToolOrServiceVersionPage.Props,
): JSX.Element {
const router = useRouter()
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _toolOrService = useToolVersion({ persistentId, versionId })
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _toolOrService = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
useToolVersion({ persistentId, versionId }, undefined, { enabled: router.isReady })
: // eslint-disable-next-line react-hooks/rules-of-hooks
useTool({ persistentId, draft: true }, undefined, { enabled: router.isReady })
const toolOrService = _toolOrService.data
const router = useRouter()
const { t } = useI18n<'authenticated' | 'common'>()
const category = toolOrService?.category ?? 'tool-or-service'
......
......@@ -22,7 +22,10 @@ import { useTrainingMaterialFormFields } from '@/components/item-form/useTrainin
import { useTrainingMaterialValidationSchema } from '@/components/item-form/useTrainingMaterialValidationSchema'
import { useUpdateItemMeta } from '@/components/item-form/useUpdateItemMeta'
import type { TrainingMaterial, TrainingMaterialInput } from '@/data/sshoc/api/training-material'
import { useTrainingMaterialVersion } from '@/data/sshoc/hooks/training-material'
import {
useTrainingMaterial,
useTrainingMaterialVersion,
} from '@/data/sshoc/hooks/training-material'
import type { PageComponent } from '@/lib/core/app/types'
import { FORM_ERROR } from '@/lib/core/form/Form'
import { getLocale } from '@/lib/core/i18n/getLocale'
......@@ -32,6 +35,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Centered } from '@/lib/core/ui/Centered/Centered'
import { FullPage } from '@/lib/core/ui/FullPage/FullPage'
......@@ -96,11 +100,23 @@ export default function EditTrainingMaterialVersionPage(
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _trainingMaterial = useTrainingMaterialVersion({ persistentId, versionId }, undefined, {
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _trainingMaterial = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
useTrainingMaterialVersion({ persistentId, versionId }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
: // eslint-disable-next-line react-hooks/rules-of-hooks
useTrainingMaterial({ persistentId, draft: true }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const trainingMaterial = _trainingMaterial.data
const category = trainingMaterial?.category ?? 'training-material'
......
......@@ -33,7 +33,10 @@ import { ItemVersionScreenLayout } from '@/components/item/ItemVersionScreenLayo
import { TrainingMaterialContentContributors } from '@/components/item/TrainingMaterialContentContributors'
import { TrainingMaterialVersionControls } from '@/components/item/TrainingMaterialVersionControls'
import type { TrainingMaterial } from '@/data/sshoc/api/training-material'
import { useTrainingMaterialVersion } from '@/data/sshoc/hooks/training-material'
import {
useTrainingMaterial,
useTrainingMaterialVersion,
} from '@/data/sshoc/hooks/training-material'
import type { PageComponent } from '@/lib/core/app/types'
import { getLocale } from '@/lib/core/i18n/getLocale'
import { getLocales } from '@/lib/core/i18n/getLocales'
......@@ -42,6 +45,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Breadcrumbs } from '@/lib/core/ui/Breadcrumbs/Breadcrumbs'
import { Centered } from '@/lib/core/ui/Centered/Centered'
......@@ -100,12 +104,20 @@ export async function getStaticProps(
export default function TrainingMaterialVersionPage(
props: TrainingMaterialVersionPage.Props,
): JSX.Element {
const router = useRouter()
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _trainingMaterial = useTrainingMaterialVersion({ persistentId, versionId })
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _trainingMaterial = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
useTrainingMaterialVersion({ persistentId, versionId }, undefined, {
enabled: router.isReady,
})
: // eslint-disable-next-line react-hooks/rules-of-hooks
useTrainingMaterial({ persistentId, draft: true }, undefined, { enabled: router.isReady })
const trainingMaterial = _trainingMaterial.data
const router = useRouter()
const { t } = useI18n<'authenticated' | 'common'>()
const category = trainingMaterial?.category ?? 'training-material'
......
......@@ -23,7 +23,7 @@ import { useWorkflowFormPage } from '@/components/item-form/useWorkflowFormPage'
import { useWorkflowValidationSchema } from '@/components/item-form/useWorkflowValidationSchema'
import { WorkflowForm } from '@/components/item-form/WorkflowForm'
import type { Workflow, WorkflowInput } from '@/data/sshoc/api/workflow'
import { useWorkflowVersion } from '@/data/sshoc/hooks/workflow'
import { useWorkflow, useWorkflowVersion } from '@/data/sshoc/hooks/workflow'
import type { PageComponent } from '@/lib/core/app/types'
import { FORM_ERROR } from '@/lib/core/form/Form'
import { getLocale } from '@/lib/core/i18n/getLocale'
......@@ -33,6 +33,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Centered } from '@/lib/core/ui/Centered/Centered'
import { FullPage } from '@/lib/core/ui/FullPage/FullPage'
......@@ -95,12 +96,24 @@ export default function EditWorkflowVersionPage(props: EditWorkflowVersionPage.P
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _workflow = useWorkflowVersion({ persistentId, versionId }, undefined, {
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const workflow = _workflow.data
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _dataset = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
useWorkflowVersion({ persistentId, versionId }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
: // eslint-disable-next-line react-hooks/rules-of-hooks
useWorkflow({ persistentId, draft: true }, undefined, {
enabled: router.isReady,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
})
const workflow = _dataset.data
const { page, setPage } = useWorkflowFormPage()
......
......@@ -33,7 +33,7 @@ import { ItemVersionScreenLayout } from '@/components/item/ItemVersionScreenLayo
import { WorkflowContentContributors } from '@/components/item/WorkflowContentContributors'
import { WorkflowVersionControls } from '@/components/item/WorkflowVersionControls'
import type { Workflow } from '@/data/sshoc/api/workflow'
import { useWorkflowVersion } from '@/data/sshoc/hooks/workflow'
import { useWorkflow, useWorkflowVersion } from '@/data/sshoc/hooks/workflow'
import type { PageComponent } from '@/lib/core/app/types'
import { getLocale } from '@/lib/core/i18n/getLocale'
import { getLocales } from '@/lib/core/i18n/getLocales'
......@@ -42,6 +42,7 @@ import type { WithDictionaries } from '@/lib/core/i18n/types'
import { useI18n } from '@/lib/core/i18n/useI18n'
import { PageMetadata } from '@/lib/core/metadata/PageMetadata'
import { routes } from '@/lib/core/navigation/routes'
import { useSearchParams } from '@/lib/core/navigation/useSearchParams'
import { PageMainContent } from '@/lib/core/page/PageMainContent'
import { Breadcrumbs } from '@/lib/core/ui/Breadcrumbs/Breadcrumbs'
import { Centered } from '@/lib/core/ui/Centered/Centered'
......@@ -98,12 +99,18 @@ export async function getStaticProps(
}
export default function WorkflowVersionPage(props: WorkflowVersionPage.Props): JSX.Element {
const router = useRouter()
const { persistentId, versionId: _versionId } = props.params
const versionId = Number(_versionId)
const _workflow = useWorkflowVersion({ persistentId, versionId })
const searchParams = useSearchParams()
const isDraftVersion = searchParams != null && searchParams.get('draft') != null
const _workflow = !isDraftVersion
? // eslint-disable-next-line react-hooks/rules-of-hooks
useWorkflowVersion({ persistentId, versionId }, undefined, { enabled: router.isReady })
: // eslint-disable-next-line react-hooks/rules-of-hooks
useWorkflow({ persistentId, draft: true }, undefined, { enabled: router.isReady })
const workflow = _workflow.data
const router = useRouter()
const { t } = useI18n<'authenticated' | 'common'>()
const category = workflow?.category ?? 'workflow'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment