mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-11 18:46:07 +00:00
perf: Optimize recommendation system and improve error handling
- Fix N+1 query problem in preset package fetching * Search with limit 5 to find best matches * Case-insensitive package name matching * Fallback to most popular when no exact match - Improve category filtering accuracy * Update category mapping to match database schema * Remove duplicate packages in category fetching * Better distribution across categories - Add version control for localStorage profile * Support future schema migrations * Auto-migrate old profiles to new version * Persist version in localStorage - Enhance error handling * Specific error messages for 400/500/404 responses * Network error detection * User-friendly error messages in UI - Fix OS detection fallback * Default to ubuntu when detection returns unknown * Prevent empty OS selection in onboarding - Add better API validation * Explicit limit range validation (1-50) * Clear error messages for invalid inputs
This commit is contained in:
@@ -38,7 +38,10 @@ export function OnboardingModal({
|
||||
const { t } = useLocale()
|
||||
const [step, setStep] = useState(1)
|
||||
const [selectedCategories, setSelectedCategories] = useState<UserCategory[]>([])
|
||||
const [selectedOS, setSelectedOS] = useState<string>(detectedOS)
|
||||
// Default to ubuntu if OS detection fails
|
||||
const [selectedOS, setSelectedOS] = useState<string>(
|
||||
detectedOS !== 'unknown' ? detectedOS : 'ubuntu'
|
||||
)
|
||||
const [experienceLevel, setExperienceLevel] = useState<ExperienceLevel>('beginner')
|
||||
|
||||
if (!isOpen) return null
|
||||
|
||||
Reference in New Issue
Block a user