refactor: route next/navigation through compat re-export (#33636)

This commit is contained in:
yyh
2026-03-18 12:57:03 +08:00
committed by GitHub
parent 04c0bf61fa
commit 296b7044af
269 changed files with 320 additions and 328 deletions

View File

@ -8,7 +8,7 @@ const mockReplace = vi.fn()
const mockPush = vi.fn()
const mockInstalledAppsData = { installed_apps: [] as const }
vi.mock('next/navigation', () => ({
vi.mock('@/next/navigation', () => ({
useRouter: () => ({
replace: mockReplace,
push: mockPush,

View File

@ -19,7 +19,7 @@ vi.mock('@emoji-mart/data', () => ({
},
}))
vi.mock('next/navigation', () => ({
vi.mock('@/next/navigation', () => ({
useParams: () => ({}),
}))

View File

@ -13,7 +13,7 @@ let mockIsPending = false
let mockInstalledApps: InstalledApp[] = []
let mockMediaType: string = MediaType.pc
vi.mock('next/navigation', () => ({
vi.mock('@/next/navigation', () => ({
useSelectedLayoutSegments: () => mockSegments,
useRouter: () => ({
push: mockPush,

View File

@ -3,7 +3,7 @@ import AppNavItem from '../index'
const mockPush = vi.fn()
vi.mock('next/navigation', () => ({
vi.mock('@/next/navigation', () => ({
useRouter: () => ({
push: mockPush,
}),

View File

@ -2,11 +2,11 @@
import type { AppIconType } from '@/types/app'
import { useHover } from 'ahooks'
import { useRouter } from 'next/navigation'
import * as React from 'react'
import { useRef } from 'react'
import AppIcon from '@/app/components/base/app-icon'
import ItemOperation from '@/app/components/explore/item-operation'
import { useRouter } from '@/next/navigation'
import { cn } from '@/utils/classnames'
export type IAppNavItemProps = {

View File

@ -1,6 +1,5 @@
'use client'
import { useBoolean } from 'ahooks'
import { useSelectedLayoutSegments } from 'next/navigation'
import * as React from 'react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
@ -8,6 +7,7 @@ import Confirm from '@/app/components/base/confirm'
import Divider from '@/app/components/base/divider'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import Link from '@/next/link'
import { useSelectedLayoutSegments } from '@/next/navigation'
import { useGetInstalledApps, useUninstallApp, useUpdateAppPinStatus } from '@/service/use-explore'
import { cn } from '@/utils/classnames'
import Toast from '../../base/toast'