From 4fbe52da401cbb558c584761de0fbe390ad07834 Mon Sep 17 00:00:00 2001 From: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Date: Thu, 27 Feb 2025 15:11:42 +0800 Subject: [PATCH] fix: update dependencies and improve app detail handling (#14444) --- .../(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx | 6 +++--- web/app/components/app-sidebar/navLink.tsx | 4 ++-- web/app/components/app/configuration/index.tsx | 2 +- web/app/components/app/create-app-dialog/app-list/index.tsx | 4 ++-- web/app/components/explore/app-list/index.tsx | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx index 69a423ab21..3b43186196 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout.tsx @@ -94,7 +94,7 @@ const AppDetailLayout: FC = (props) => { }, ] return navs - }, [t]) + }, []) useEffect(() => { if (appDetail) { @@ -120,7 +120,7 @@ const AppDetailLayout: FC = (props) => { }).finally(() => { setIsLoadingAppDetail(false) }) - }, [appId, router, setAppDetail]) + }, [appId, pathname]) useEffect(() => { if (!appDetailRes || isLoadingCurrentWorkspace || isLoadingAppDetail) @@ -148,7 +148,7 @@ const AppDetailLayout: FC = (props) => { } } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [appDetailRes, appId, getNavigations, isCurrentWorkspaceEditor, isLoadingAppDetail, isLoadingCurrentWorkspace, router, setAppDetail, systemFeatures.enable_web_sso_switch_component]) + }, [appDetailRes, isCurrentWorkspaceEditor, isLoadingAppDetail, isLoadingCurrentWorkspace, systemFeatures.enable_web_sso_switch_component]) useUnmount(() => { setAppDetail() diff --git a/web/app/components/app-sidebar/navLink.tsx b/web/app/components/app-sidebar/navLink.tsx index bec6bf105f..4e04fcc3e1 100644 --- a/web/app/components/app-sidebar/navLink.tsx +++ b/web/app/components/app-sidebar/navLink.tsx @@ -3,13 +3,13 @@ import { useSelectedLayoutSegment } from 'next/navigation' import Link from 'next/link' import classNames from '@/utils/classnames' +import type { RemixiconComponentType } from '@remixicon/react' export type NavIcon = React.ComponentType< React.PropsWithoutRef> & { title?: string | undefined titleId?: string | undefined -} -> +}> | RemixiconComponentType export type NavLinkProps = { name: string diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index 5f2c8909a5..87f71f54a0 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -94,7 +94,7 @@ const Configuration: FC = () => { }))) const { data: fileUploadConfigResponse } = useSWR({ url: '/files/upload' }, fetchFileUploadConfig) - const latestPublishedAt = useMemo(() => appDetail?.model_config.updated_at, [appDetail]) + const latestPublishedAt = useMemo(() => appDetail?.model_config?.updated_at, [appDetail]) const [formattingChanged, setFormattingChanged] = useState(false) const { setShowAccountSettingModal } = useModalContext() const [hasFetchedDetail, setHasFetchedDetail] = useState(false) diff --git a/web/app/components/app/create-app-dialog/app-list/index.tsx b/web/app/components/app/create-app-dialog/app-list/index.tsx index a545774f2c..69990f9311 100644 --- a/web/app/components/app/create-app-dialog/app-list/index.tsx +++ b/web/app/components/app/create-app-dialog/app-list/index.tsx @@ -128,7 +128,7 @@ const Apps = ({ icon_background, description, }) => { - const { export_data } = await fetchAppDetail( + const { export_data, mode } = await fetchAppDetail( currApp?.app.id as string, ) try { @@ -151,7 +151,7 @@ const Apps = ({ if (app.app_id) await handleCheckPluginDependencies(app.app_id) localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') - getRedirection(isCurrentWorkspaceEditor, { id: app.app_id }, push) + getRedirection(isCurrentWorkspaceEditor, { id: app.app_id, mode }, push) } catch (e) { Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) diff --git a/web/app/components/explore/app-list/index.tsx b/web/app/components/explore/app-list/index.tsx index 458aadcb61..4fef183d52 100644 --- a/web/app/components/explore/app-list/index.tsx +++ b/web/app/components/explore/app-list/index.tsx @@ -126,7 +126,7 @@ const Apps = ({ icon_background, description, }) => { - const { export_data } = await fetchAppDetail( + const { export_data, mode } = await fetchAppDetail( currApp?.app.id as string, ) try { @@ -149,7 +149,7 @@ const Apps = ({ if (app.app_id) await handleCheckPluginDependencies(app.app_id) localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') - getRedirection(isCurrentWorkspaceEditor, { id: app.app_id }, push) + getRedirection(isCurrentWorkspaceEditor, { id: app.app_id, mode }, push) } catch (e) { Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') })