mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 17:45:57 +08:00
fix: app nav call detail match explore app detail page (#469)
This commit is contained in:
parent
1226d73159
commit
0462f09ecc
@ -1,6 +1,6 @@
|
|||||||
import { useCallback, useState } from 'react'
|
import { useCallback, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useParams } from 'next/navigation'
|
import { useParams, usePathname } from 'next/navigation'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import useSWRInfinite from 'swr/infinite'
|
import useSWRInfinite from 'swr/infinite'
|
||||||
import { flatten } from 'lodash-es'
|
import { flatten } from 'lodash-es'
|
||||||
@ -21,7 +21,8 @@ const AppNav = () => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [showNewAppDialog, setShowNewAppDialog] = useState(false)
|
const [showNewAppDialog, setShowNewAppDialog] = useState(false)
|
||||||
const { appId } = useParams()
|
const { appId } = useParams()
|
||||||
const { data: currentApp } = useSWR(appId ? { url: '/apps', id: appId } : null, fetchAppDetail)
|
const isAppDetailPage = usePathname().split('/').includes('app')
|
||||||
|
const { data: currentApp } = useSWR((appId && isAppDetailPage) ? { url: '/apps', id: appId } : null, fetchAppDetail)
|
||||||
const { data: appsData, setSize } = useSWRInfinite(appId ? getKey : () => null, fetchAppList, { revalidateFirstPage: false })
|
const { data: appsData, setSize } = useSWRInfinite(appId ? getKey : () => null, fetchAppList, { revalidateFirstPage: false })
|
||||||
const appItems = flatten(appsData?.map(appData => appData.data))
|
const appItems = flatten(appsData?.map(appData => appData.data))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user