mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 20:48:01 +08:00
fix: applist not refresh after customize
This commit is contained in:
parent
d33bb007f4
commit
542ac8e8a3
@ -8,6 +8,7 @@ import NewAppCard from './NewAppCard'
|
|||||||
import { AppListResponse } from '@/models/app'
|
import { AppListResponse } from '@/models/app'
|
||||||
import { fetchAppList } from '@/service/apps'
|
import { fetchAppList } from '@/service/apps'
|
||||||
import { useSelector } from '@/context/app-context'
|
import { useSelector } from '@/context/app-context'
|
||||||
|
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
||||||
|
|
||||||
const getKey = (pageIndex: number, previousPageData: AppListResponse) => {
|
const getKey = (pageIndex: number, previousPageData: AppListResponse) => {
|
||||||
if (!pageIndex || previousPageData.has_more)
|
if (!pageIndex || previousPageData.has_more)
|
||||||
@ -21,6 +22,13 @@ const Apps = () => {
|
|||||||
const pageContainerRef = useSelector(state => state.pageContainerRef)
|
const pageContainerRef = useSelector(state => state.pageContainerRef)
|
||||||
const anchorRef = useRef<HTMLAnchorElement>(null)
|
const anchorRef = useRef<HTMLAnchorElement>(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(localStorage.getItem(NEED_REFRESH_APP_LIST_KEY) === '1') {
|
||||||
|
localStorage.removeItem(NEED_REFRESH_APP_LIST_KEY)
|
||||||
|
mutate()
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadingStateRef.current = isLoading
|
loadingStateRef.current = isLoading
|
||||||
}, [isLoading])
|
}, [isLoading])
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { fetchAppList, installApp, fetchAppDetail } from '@/service/explore'
|
|||||||
import { createApp } from '@/service/apps'
|
import { createApp } from '@/service/apps'
|
||||||
import CreateAppModal from '@/app/components/explore/create-app-modal'
|
import CreateAppModal from '@/app/components/explore/create-app-modal'
|
||||||
import Loading from '@/app/components/base/loading'
|
import Loading from '@/app/components/base/loading'
|
||||||
|
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
||||||
|
|
||||||
import s from './style.module.css'
|
import s from './style.module.css'
|
||||||
import Toast from '../../base/toast'
|
import Toast from '../../base/toast'
|
||||||
@ -64,6 +65,7 @@ const Apps: FC = ({ }) => {
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
message: t('app.newApp.appCreated'),
|
message: t('app.newApp.appCreated'),
|
||||||
})
|
})
|
||||||
|
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
|
||||||
router.push(`/app/${app.id}/overview`)
|
router.push(`/app/${app.id}/overview`)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
||||||
|
|||||||
@ -99,5 +99,7 @@ export const VAR_ITEM_TEMPLATE = {
|
|||||||
|
|
||||||
export const appDefaultIconBackground = '#D5F5F6'
|
export const appDefaultIconBackground = '#D5F5F6'
|
||||||
|
|
||||||
|
export const NEED_REFRESH_APP_LIST_KEY = 'needRefreshAppList'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user