refactor: route next/link through compat re-export (#33632)

This commit is contained in:
yyh
2026-03-18 12:14:59 +08:00
committed by GitHub
parent 6100acb780
commit 69d1ccb7a7
86 changed files with 94 additions and 89 deletions

View File

@ -1,6 +1,5 @@
import type { FC, MouseEvent } from 'react'
import type { Resources } from './index'
import Link from 'next/link'
import { Fragment, useState } from 'react'
import { useTranslation } from 'react-i18next'
import FileIcon from '@/app/components/base/file-icon'
@ -9,6 +8,7 @@ import {
PortalToFollowElemContent,
PortalToFollowElemTrigger,
} from '@/app/components/base/portal-to-follow-elem'
import Link from '@/next/link'
import { useDocumentDownload } from '@/service/knowledge/use-document'
import { downloadUrl } from '@/utils/download'
import ProgressTooltip from './progress-tooltip'

View File

@ -1,7 +1,7 @@
import type { I18nKeysWithPrefix } from '@/types/i18n'
import { RiLock2Fill } from '@remixicon/react'
import Link from 'next/link'
import { useTranslation } from 'react-i18next'
import Link from '@/next/link'
import { cn } from '@/utils/classnames'
type EncryptedKey = I18nKeysWithPrefix<'common', 'provider.encrypted.'>

View File

@ -4,7 +4,7 @@ import { vi } from 'vitest'
import { AppModeEnum } from '@/types/app'
import LinkedAppsPanel from '../index'
vi.mock('next/link', () => ({
vi.mock('@/next/link', () => ({
default: ({ children, href, className }: { children: React.ReactNode, href: string, className: string }) => (
<a href={href} className={className} data-testid="link-item">
{children}

View File

@ -2,9 +2,9 @@
import type { FC } from 'react'
import type { RelatedApp } from '@/models/datasets'
import { RiArrowRightUpLine } from '@remixicon/react'
import Link from 'next/link'
import * as React from 'react'
import AppIcon from '@/app/components/base/app-icon'
import Link from '@/next/link'
import { AppModeEnum } from '@/types/app'
import { cn } from '@/utils/classnames'

View File

@ -1,7 +1,7 @@
import type { ComponentPropsWithoutRef, ReactNode } from 'react'
import { fireEvent, render, screen, within } from '@testing-library/react'
import Link from 'next/link'
import { describe, expect, it, vi } from 'vitest'
import Link from '@/next/link'
import {
DropdownMenu,
DropdownMenuContent,
@ -14,7 +14,7 @@ import {
DropdownMenuTrigger,
} from '../index'
vi.mock('next/link', () => ({
vi.mock('@/next/link', () => ({
default: ({
href,
children,