mirror of
https://github.com/langgenius/dify.git
synced 2026-08-28 20:03:22 +08:00
fix(web): invalidate app list cache after deleting app from detail page (#30751)
Signed-off-by: majiayu000 <1835304752@qq.com>
This commit is contained in:
parent
77f097ce76
commit
9d9f027246
@ -26,6 +26,7 @@ import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
|||||||
import { useAppContext } from '@/context/app-context'
|
import { useAppContext } from '@/context/app-context'
|
||||||
import { useProviderContext } from '@/context/provider-context'
|
import { useProviderContext } from '@/context/provider-context'
|
||||||
import { copyApp, deleteApp, exportAppConfig, updateAppInfo } from '@/service/apps'
|
import { copyApp, deleteApp, exportAppConfig, updateAppInfo } from '@/service/apps'
|
||||||
|
import { useInvalidateAppList } from '@/service/use-apps'
|
||||||
import { fetchWorkflowDraft } from '@/service/workflow'
|
import { fetchWorkflowDraft } from '@/service/workflow'
|
||||||
import { AppModeEnum } from '@/types/app'
|
import { AppModeEnum } from '@/types/app'
|
||||||
import { getRedirection } from '@/utils/app-redirection'
|
import { getRedirection } from '@/utils/app-redirection'
|
||||||
@ -66,6 +67,7 @@ const AppInfo = ({ expand, onlyShowDetail = false, openState = false, onDetailEx
|
|||||||
const { onPlanInfoChanged } = useProviderContext()
|
const { onPlanInfoChanged } = useProviderContext()
|
||||||
const appDetail = useAppStore(state => state.appDetail)
|
const appDetail = useAppStore(state => state.appDetail)
|
||||||
const setAppDetail = useAppStore(state => state.setAppDetail)
|
const setAppDetail = useAppStore(state => state.setAppDetail)
|
||||||
|
const invalidateAppList = useInvalidateAppList()
|
||||||
const [open, setOpen] = useState(openState)
|
const [open, setOpen] = useState(openState)
|
||||||
const [showEditModal, setShowEditModal] = useState(false)
|
const [showEditModal, setShowEditModal] = useState(false)
|
||||||
const [showDuplicateModal, setShowDuplicateModal] = useState(false)
|
const [showDuplicateModal, setShowDuplicateModal] = useState(false)
|
||||||
@ -191,6 +193,7 @@ const AppInfo = ({ expand, onlyShowDetail = false, openState = false, onDetailEx
|
|||||||
try {
|
try {
|
||||||
await deleteApp(appDetail.id)
|
await deleteApp(appDetail.id)
|
||||||
notify({ type: 'success', message: t('appDeleted', { ns: 'app' }) })
|
notify({ type: 'success', message: t('appDeleted', { ns: 'app' }) })
|
||||||
|
invalidateAppList()
|
||||||
onPlanInfoChanged()
|
onPlanInfoChanged()
|
||||||
setAppDetail()
|
setAppDetail()
|
||||||
replace('/apps')
|
replace('/apps')
|
||||||
@ -202,7 +205,7 @@ const AppInfo = ({ expand, onlyShowDetail = false, openState = false, onDetailEx
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
setShowConfirmDelete(false)
|
setShowConfirmDelete(false)
|
||||||
}, [appDetail, notify, onPlanInfoChanged, replace, setAppDetail, t])
|
}, [appDetail, invalidateAppList, notify, onPlanInfoChanged, replace, setAppDetail, t])
|
||||||
|
|
||||||
const { isCurrentWorkspaceEditor } = useAppContext()
|
const { isCurrentWorkspaceEditor } = useAppContext()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user