diff --git a/web/app/components/plugins/marketplace/hooks.ts b/web/app/components/plugins/marketplace/hooks.ts index 03e308d0a4..e1e5d34e2b 100644 --- a/web/app/components/plugins/marketplace/hooks.ts +++ b/web/app/components/plugins/marketplace/hooks.ts @@ -27,6 +27,8 @@ import i18n from '@/i18n-config/i18next-config' import { postMarketplace } from '@/service/base' import type { PluginsFromMarketplaceResponse } from '@/app/components/plugins/types' +const SCROLL_BOTTOM_THRESHOLD = 100 + export const useMarketplaceCollectionsAndPlugins = () => { const [queryParams, setQueryParams] = useState() const [marketplaceCollectionsOverride, setMarketplaceCollections] = useState() @@ -243,7 +245,7 @@ export const useMarketplaceContainerScroll = ( scrollHeight, clientHeight, } = target - if (scrollTop + clientHeight >= scrollHeight - 5 && scrollTop > 0) + if (scrollTop + clientHeight >= scrollHeight - SCROLL_BOTTOM_THRESHOLD && scrollTop > 0) callback() }, [callback]) diff --git a/web/app/components/tools/marketplace/hooks.ts b/web/app/components/tools/marketplace/hooks.ts index 81c4bb475b..54f8b845bd 100644 --- a/web/app/components/tools/marketplace/hooks.ts +++ b/web/app/components/tools/marketplace/hooks.ts @@ -12,6 +12,8 @@ import { PluginCategoryEnum } from '@/app/components/plugins/types' import { getMarketplaceListCondition } from '@/app/components/plugins/marketplace/utils' import { useAllToolProviders } from '@/service/use-tools' +const SCROLL_BOTTOM_THRESHOLD = 100 + export const useMarketplace = (searchPluginText: string, filterPluginTags: string[]) => { const { data: toolProvidersData, isSuccess } = useAllToolProviders() const exclude = useMemo(() => { @@ -81,7 +83,7 @@ export const useMarketplace = (searchPluginText: string, filterPluginTags: strin scrollHeight, clientHeight, } = target - if (scrollTop + clientHeight >= scrollHeight - 5 && scrollTop > 0) { + if (scrollTop + clientHeight >= scrollHeight - SCROLL_BOTTOM_THRESHOLD && scrollTop > 0) { const searchPluginText = searchPluginTextRef.current const filterPluginTags = filterPluginTagsRef.current if (hasNextPage && (!!searchPluginText || !!filterPluginTags.length))