fix: cancel marketplace debounced search when clear search keywords (#16614)

This commit is contained in:
zxhlyh 2025-03-24 15:17:12 +08:00 • committed by GitHub
commit 05eaef84bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -143,6 +143,7 @@ export const MarketplaceContextProvider = ({
resetPlugins,
queryPlugins,
queryPluginsWithDebounced,
cancelQueryPluginsWithDebounced,
isLoading: isPluginsLoading,
} = useMarketplacePlugins()
@ -209,12 +210,13 @@ export const MarketplaceContextProvider = ({
const handleQuery = useCallback((debounced?: boolean) => {
if (!searchPluginTextRef.current && !filterPluginTagsRef.current.length) {
cancelQueryPluginsWithDebounced()
handleQueryMarketplaceCollectionsAndPlugins()
return
}
handleQueryPlugins(debounced)
}, [handleQueryMarketplaceCollectionsAndPlugins, handleQueryPlugins])
}, [handleQueryMarketplaceCollectionsAndPlugins, handleQueryPlugins, cancelQueryPluginsWithDebounced])
const handleSearchPluginTextChange = useCallback((text: string) => {
setSearchPluginText(text)