fix(web): defer try app preview loading

This commit is contained in:
yyh
2026-05-30 23:14:26 +08:00
parent 2921d27929
commit f56f93f5c2
2 changed files with 8 additions and 4 deletions

View File

@ -682,7 +682,7 @@ describe('AppList', () => {
renderAppList(true, undefined, undefined, { isCloudEdition: true })
fireEvent.click(getLastByText('explore.appCard.try'))
expect(screen.getByTestId('try-app-panel')).toBeInTheDocument()
expect(await screen.findByTestId('try-app-panel')).toBeInTheDocument()
fireEvent.click(screen.getByTestId('try-app-create'))
@ -705,6 +705,7 @@ describe('AppList', () => {
renderAppList(true, undefined, undefined, { isCloudEdition: true })
fireEvent.click(getLastByText('explore.appCard.try'))
await screen.findByTestId('try-app-panel')
fireEvent.click(screen.getByTestId('try-app-create'))
fireEvent.click(await screen.findByTestId('confirm-create'))
@ -717,7 +718,8 @@ describe('AppList', () => {
})
})
it('should close try app panel when close is clicked', () => {
it('should close try app panel when close is clicked', async () => {
vi.useRealTimers()
mockExploreData = {
categories: ['Writing'],
allList: [createApp()],
@ -726,7 +728,7 @@ describe('AppList', () => {
renderAppList(true, undefined, undefined, { isCloudEdition: true })
fireEvent.click(getLastByText('explore.appCard.try'))
expect(screen.getByTestId('try-app-panel')).toBeInTheDocument()
expect(await screen.findByTestId('try-app-panel')).toBeInTheDocument()
fireEvent.click(screen.getByTestId('try-app-close'))
expect(screen.queryByTestId('try-app-panel')).not.toBeInTheDocument()

View File

@ -18,18 +18,20 @@ import CreateAppModal from '@/app/components/explore/create-app-modal'
import { useAppContext } from '@/context/app-context'
import { useImportDSL } from '@/hooks/use-import-dsl'
import { DSLImportMode } from '@/models/app'
import dynamic from '@/next/dynamic'
import { consoleQuery } from '@/service/client'
import { fetchAppDetail } from '@/service/explore'
import { systemFeaturesQueryOptions } from '@/service/system-features'
import { useMembers } from '@/service/use-common'
import { useExploreAppList } from '@/service/use-explore'
import { trackCreateApp } from '@/utils/create-app-tracking'
import TryApp from '../try-app'
import { ExploreAppListHeader } from './explore-app-list-header'
import { ExploreRecommendations } from './explore-recommendations'
import { ExploreAppListSkeleton, ExploreHeaderSkeleton } from './loading-skeletons'
import s from './style.module.css'
const TryApp = dynamic(() => import('../try-app'), { ssr: false })
function useHomeContinueWorkApps() {
return useQuery(consoleQuery.apps.list.queryOptions({
input: {