This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

fix

+9 -80
+9 -80
app/src/components/ProfileSearch.tsx
··· 39 39 }; 40 40 }, []); 41 41 42 - // Fetch suggestions when query changes 42 + // Suggestions fetch is disabled for now 43 43 useEffect(() => { 44 - // Clear previous timer 44 + // Clear previous timer if it exists 45 45 if (debounceTimerRef.current) { 46 46 clearTimeout(debounceTimerRef.current); 47 47 } 48 - 49 - // Return early if query is too short 50 - if (query.trim().length < 2) { 51 - setSuggestions([]); 52 - setShowSuggestions(false); 53 - return; 54 - } 55 - 56 - // Set a new timer to fetch suggestions 57 - debounceTimerRef.current = setTimeout(async () => { 58 - setLoading(true); 59 - try { 60 - // Normalize query by removing @ if present 61 - const searchTerm = query.trim().startsWith('@') 62 - ? query.trim().substring(1) 63 - : query.trim(); 64 - 65 - console.log('Fetching suggestions for:', searchTerm); 66 - const response = await fetch(`/api/bluesky/search?q=${encodeURIComponent(searchTerm)}`); 67 - 68 - const data = await response.json(); 69 - 70 - if (response.ok) { 71 - console.log('Search suggestions:', data.suggestions); 72 - setSuggestions(data.suggestions); 73 - setShowSuggestions(true); 74 - } else { 75 - console.error('Search API error:', data.error, data.message); 76 - setSuggestions([]); 77 - setShowSuggestions(true); 78 - } 79 - } catch (error) { 80 - console.error('Failed to fetch suggestions:', error); 81 - setSuggestions([]); 82 - } finally { 83 - setLoading(false); 84 - } 85 - }, 300); // 300ms debounce delay 86 - 48 + 49 + // Always hide suggestions 50 + setSuggestions([]); 51 + setShowSuggestions(false); 52 + 87 53 return () => { 88 54 if (debounceTimerRef.current) { 89 55 clearTimeout(debounceTimerRef.current); ··· 104 70 } 105 71 }; 106 72 107 - const handleSuggestionClick = (handle: string) => { 108 - router.push(`/profile/${handle}`); 109 - setQuery(`@${handle}`); 110 - setShowSuggestions(false); 111 - }; 73 + // Removed handleSuggestionClick as it's no longer needed 112 74 113 75 return ( 114 76 <div className={styles.searchContainer}> ··· 118 80 type="text" 119 81 value={query} 120 82 onChange={(e) => setQuery(e.target.value)} 121 - onFocus={() => query.trim().length >= 2 && setShowSuggestions(true)} 122 83 placeholder="Search user @handle" 123 84 className={styles.searchInput} 124 85 aria-label="Search for a user profile" ··· 130 91 </svg> 131 92 </button> 132 93 </form> 133 - 134 - {showSuggestions && ( 135 - <div ref={suggestionsRef} className={styles.suggestionsContainer}> 136 - {loading ? ( 137 - <div className={styles.loadingContainer}> 138 - <span className={styles.loadingDot}></span> 139 - <span className={styles.loadingDot}></span> 140 - <span className={styles.loadingDot}></span> 141 - </div> 142 - ) : suggestions.length > 0 ? ( 143 - <ul className={styles.suggestionsList}> 144 - {suggestions.map((suggestion) => ( 145 - <li key={suggestion.did} className={styles.suggestionItem}> 146 - <button 147 - type="button" 148 - onClick={() => handleSuggestionClick(suggestion.handle)} 149 - className={styles.suggestionButton} 150 - > 151 - <div className={styles.suggestionInfo}> 152 - {suggestion.displayName && ( 153 - <span className={styles.displayName}>{suggestion.displayName}</span> 154 - )} 155 - <span className={styles.handle}>@{suggestion.handle}</span> 156 - </div> 157 - </button> 158 - </li> 159 - ))} 160 - </ul> 161 - ) : ( 162 - <div className={styles.noResults}>No users found</div> 163 - )} 164 - </div> 165 - )} 94 + {/* Suggestions dropdown removed */} 166 95 </div> 167 96 ); 168 97 }