fix(suggestions): improve pool management and artist identity validation
- Increase pool sizes (INITIAL_POOL 18->30, EXPANDED_POOL 60->100, MAX_POOL 120->200) - Add auto-refresh when available tracks fall below threshold (MIN_AVAILABLE_THRESHOLD=12) - Add artist identity validation to filter incompatible genres (prevents merengue in metal playlists) - Log when artists are skipped due to incompatible disambiguation - Increase backend defaults (max_artists 20->30, tracks_per_artist 5->6, max_pool_size 100->150)
This commit is contained in:
1 parent
1bb9fc8382
commit
ed1bd31554
4 files changed
+63
-9
No files matched your search
@@ -113,9 +113,10 @@
|
||||
|
||||
// Configuration
|
||||
const VISIBLE_COUNT = 6;
|
||||
const INITIAL_POOL = 18; // 3 pages worth
|
||||
const EXPANDED_POOL = 60; // Full pool on demand
|
||||
const MAX_POOL = 120; // Maximum pool for "load more variety"
|
||||
const INITIAL_POOL = 30; // 5 pages worth (increased from 18)
|
||||
const EXPANDED_POOL = 100; // Full pool on demand (increased from 60)
|
||||
const MAX_POOL = 200; // Maximum pool for "load more variety" (increased from 120)
|
||||
const MIN_AVAILABLE_THRESHOLD = 12; // Auto-refresh when available tracks fall below this
|
||||
|
||||
// Track user interaction to detect when they want more variety
|
||||
let completedCycles = $state(0); // How many times user cycled through all pages
|
||||
@@ -177,6 +178,18 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Auto-refresh when available tracks fall below threshold (pool exhaustion fix)
|
||||
$effect(() => {
|
||||
const availableCount = filteredPool.length;
|
||||
const isPoolLow = availableCount < MIN_AVAILABLE_THRESHOLD && availableCount > 0;
|
||||
const canExpand = hasLoadedOnce && !loading && !loadingMore && pool.length < MAX_POOL;
|
||||
|
||||
if (isPoolLow && canExpand) {
|
||||
log(`Pool running low (${availableCount} available), auto-expanding...`);
|
||||
void handleLoadMoreVariety();
|
||||
}
|
||||
});
|
||||
|
||||
async function loadSuggestions(expanded: boolean) {
|
||||
if (loading) {
|
||||
log('Already loading, skipping');
|
||||
|
||||
Reference in new issue
Block a user