import React, { FC, memo } from 'react'; import { useTranslation } from 'react-i18next'; import { useSWRxV5MigrationStatus } from '~/stores/page-listing'; import { useCurrentPagePath, useCurrentPageId, useTargetAndAncestors, useIsGuestUser, useNotFoundTargetPathOrId, } from '~/stores/context'; import ItemsTree from './PageTree/ItemsTree'; import { PrivateLegacyPagesLink } from './PageTree/PrivateLegacyPagesLink'; const PageTree: FC = memo(() => { const { t } = useTranslation(); const { data: isGuestUser } = useIsGuestUser(); const { data: currentPath } = useCurrentPagePath(); const { data: targetId } = useCurrentPageId(); const { data: targetAndAncestorsData } = useTargetAndAncestors(); const { data: notFoundTargetPathOrIdData } = useNotFoundTargetPathOrId(); const { data: migrationStatus } = useSWRxV5MigrationStatus(); const targetPathOrId = targetId || notFoundTargetPathOrIdData?.notFoundTargetPathOrId; if (migrationStatus == null) { return ( <>