mirror of
https://github.com/langgenius/dify.git
synced 2026-05-01 14:16:40 +08:00
app list mutation
This commit is contained in:
parent
e13f8da9d5
commit
62919a9ff5
@ -53,7 +53,7 @@ const Apps = () => {
|
|||||||
const { data, isLoading, setSize, mutate } = useSWRInfinite(
|
const { data, isLoading, setSize, mutate } = useSWRInfinite(
|
||||||
(pageIndex: number, previousPageData: AppListResponse) => getKey(pageIndex, previousPageData, activeTab, searchKeywords),
|
(pageIndex: number, previousPageData: AppListResponse) => getKey(pageIndex, previousPageData, activeTab, searchKeywords),
|
||||||
fetchAppList,
|
fetchAppList,
|
||||||
{ revalidateFirstPage: false },
|
{ revalidateFirstPage: true },
|
||||||
)
|
)
|
||||||
|
|
||||||
const anchorRef = useRef<HTMLDivElement>(null)
|
const anchorRef = useRef<HTMLDivElement>(null)
|
||||||
@ -71,7 +71,7 @@ const Apps = () => {
|
|||||||
localStorage.removeItem(NEED_REFRESH_APP_LIST_KEY)
|
localStorage.removeItem(NEED_REFRESH_APP_LIST_KEY)
|
||||||
mutate()
|
mutate()
|
||||||
}
|
}
|
||||||
}, [mutate, t])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let observer: IntersectionObserver | undefined
|
let observer: IntersectionObserver | undefined
|
||||||
|
|||||||
@ -128,6 +128,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
|
|||||||
notify({ type: 'success', message: t('app.appDeleted') })
|
notify({ type: 'success', message: t('app.appDeleted') })
|
||||||
mutateApps()
|
mutateApps()
|
||||||
onPlanInfoChanged()
|
onPlanInfoChanged()
|
||||||
|
setAppDetail()
|
||||||
replace('/apps')
|
replace('/apps')
|
||||||
}
|
}
|
||||||
catch (e: any) {
|
catch (e: any) {
|
||||||
|
|||||||
@ -58,6 +58,7 @@ const AppContext = createContext<AppContextValue>({
|
|||||||
},
|
},
|
||||||
currentWorkspace: initialWorkspaceInfo,
|
currentWorkspace: initialWorkspaceInfo,
|
||||||
isCurrentWorkspaceManager: false,
|
isCurrentWorkspaceManager: false,
|
||||||
|
isCurrentWorkspaceOwner: false,
|
||||||
mutateUserProfile: () => { },
|
mutateUserProfile: () => { },
|
||||||
mutateCurrentWorkspace: () => { },
|
mutateCurrentWorkspace: () => { },
|
||||||
pageContainerRef: createRef(),
|
pageContainerRef: createRef(),
|
||||||
@ -76,7 +77,7 @@ export type AppContextProviderProps = {
|
|||||||
export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) => {
|
export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) => {
|
||||||
const pageContainerRef = useRef<HTMLDivElement>(null)
|
const pageContainerRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
const { data: appList, mutate: mutateApps } = useSWR({ url: '/apps', params: { page: 1 } }, fetchAppList)
|
const { data: appList, mutate: mutateApps } = useSWR({ url: '/apps', params: { page: 1, limit: 30, name: '' } }, fetchAppList)
|
||||||
const { data: userProfileResponse, mutate: mutateUserProfile } = useSWR({ url: '/account/profile', params: {} }, fetchUserProfile)
|
const { data: userProfileResponse, mutate: mutateUserProfile } = useSWR({ url: '/account/profile', params: {} }, fetchUserProfile)
|
||||||
const { data: currentWorkspaceResponse, mutate: mutateCurrentWorkspace } = useSWR({ url: '/workspaces/current', params: {} }, fetchCurrentWorkspace)
|
const { data: currentWorkspaceResponse, mutate: mutateCurrentWorkspace } = useSWR({ url: '/workspaces/current', params: {} }, fetchCurrentWorkspace)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user