[PR #23687] fix: improve GotoAnything search reliability and user experience #30355

Closed
opened 2026-02-21 20:47:20 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/23687

State: closed
Merged: Yes


Problem Description

The GotoAnything search feature had several critical issues affecting user experience:

1. Search Failure on Service Unavailability

  • Used Promise.all() for concurrent searches, causing complete failure if any single service (app/knowledge/plugin/node) was unavailable
  • Users would see "failed to fetch" errors after 5-10 seconds even when other services were working
  • Poor resilience in production environments

2. Cache Contamination Between Search Modes

  • Incomplete cache keys caused cross-contamination between @command searches and general searches
  • Example: After searching @app test, a subsequent search for test would incorrectly show cached app-only results
  • Users received misleading search results

3. Problematic Placeholder Data Logic

  • placeholderData logic returned unrelated historical results during loading
  • Caused confusing UX where users saw wrong results before actual search completed

4. Poor Error Communication

  • Generic error messages without context
  • No indication of search mode or partial failures
  • Users couldn't understand what was happening

Solution

Enhanced Concurrent Search Strategy

  • Replaced Promise.all with Promise.allSettled + individual try-catch blocks
  • Now gracefully handles partial service failures
  • Shows available results even when some services are down
  • Added proper error logging for debugging

Fixed Cache Key Design

  • Comprehensive cache keys including search mode, page context, locale, and available actions
  • Prevents cross-contamination between different search types
  • ['goto-anything', 'search-result', query, searchMode, isWorkflowPage, locale, actions]

Removed Problematic Placeholder Logic

  • Eliminated incorrect cache reuse mechanism
  • Let React Query handle loading states properly
  • Added proper staleTime and gcTime for better caching

Improved User Experience

  • Search Mode Indicator: Visual badge showing current search type (e.g., "APP only")
  • Context-Aware Error Messages: Different messages for network errors vs. no results
  • Enhanced Status Bar: Shows result count, search context, and usage hints
  • Smart Guidance: Suggests how to expand or narrow search based on current mode

Test Cases Covered

  • Partial service failures now show available results instead of complete failure
  • @command searches and general searches have isolated caches
  • No more incorrect placeholder data display
  • Clear visual indicators for current search mode
  • Proper error messages for different failure scenarios

Technical Details

Files Modified:

  • actions/index.ts: Replaced Promise.all with resilient error handling
  • index.tsx: Fixed caching, removed problematic placeholderData, enhanced UI

Backward Compatibility: Fully backward compatible, no breaking changes

Performance Impact: Improved - better caching and reduced failed requests

**Original Pull Request:** https://github.com/langgenius/dify/pull/23687 **State:** closed **Merged:** Yes --- ## Problem Description The GotoAnything search feature had several critical issues affecting user experience: ### 1. **Search Failure on Service Unavailability** - Used `Promise.all()` for concurrent searches, causing complete failure if any single service (app/knowledge/plugin/node) was unavailable - Users would see "failed to fetch" errors after 5-10 seconds even when other services were working - Poor resilience in production environments ### 2. **Cache Contamination Between Search Modes** - Incomplete cache keys caused cross-contamination between @command searches and general searches - Example: After searching `@app test`, a subsequent search for `test` would incorrectly show cached app-only results - Users received misleading search results ### 3. **Problematic Placeholder Data Logic** - `placeholderData` logic returned unrelated historical results during loading - Caused confusing UX where users saw wrong results before actual search completed ### 4. **Poor Error Communication** - Generic error messages without context - No indication of search mode or partial failures - Users couldn't understand what was happening ## Solution ### **Enhanced Concurrent Search Strategy** - Replaced `Promise.all` with `Promise.allSettled` + individual try-catch blocks - Now gracefully handles partial service failures - Shows available results even when some services are down - Added proper error logging for debugging ### **Fixed Cache Key Design** - Comprehensive cache keys including search mode, page context, locale, and available actions - Prevents cross-contamination between different search types - `['goto-anything', 'search-result', query, searchMode, isWorkflowPage, locale, actions]` ### **Removed Problematic Placeholder Logic** - Eliminated incorrect cache reuse mechanism - Let React Query handle loading states properly - Added proper `staleTime` and `gcTime` for better caching ### **Improved User Experience** - **Search Mode Indicator**: Visual badge showing current search type (e.g., "APP only") - **Context-Aware Error Messages**: Different messages for network errors vs. no results - **Enhanced Status Bar**: Shows result count, search context, and usage hints - **Smart Guidance**: Suggests how to expand or narrow search based on current mode ## Test Cases Covered - ✅ Partial service failures now show available results instead of complete failure - ✅ @command searches and general searches have isolated caches - ✅ No more incorrect placeholder data display - ✅ Clear visual indicators for current search mode - ✅ Proper error messages for different failure scenarios ## Technical Details **Files Modified:** - `actions/index.ts`: Replaced Promise.all with resilient error handling - `index.tsx`: Fixed caching, removed problematic placeholderData, enhanced UI **Backward Compatibility:** ✅ Fully backward compatible, no breaking changes **Performance Impact:** ✅ Improved - better caching and reduced failed requests
yindo added the pull-request label 2026-02-21 20:47:20 -05:00
yindo closed this issue 2026-02-21 20:47:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30355