fix: rename t variable in $derived() blocks to prevent PostCSS errors
The Svelte 5 CSS extraction breaks when t is used as a callback parameter inside $derived() or $derived.by() blocks. Renamed to track, item, or lt in PlaylistDetailView, FavoritesView, PlaylistSuggestions, and PlaylistTagFilter.
This commit is contained in:
1 parent
5e3e3c252a
commit
12faa5837c
4 files changed
+13
-13
No files matched your search
@@ -126,17 +126,17 @@
|
||||
const dismissedIds = $derived(getDismissedTrackIds(playlistId));
|
||||
const filteredPool = $derived.by(() => {
|
||||
// First filter by ID and dismissed
|
||||
const byId = pool.filter(t =>
|
||||
!dismissedIds.has(t.track_id) && !excludeTrackIds.includes(t.track_id)
|
||||
const byId = pool.filter(item =>
|
||||
!dismissedIds.has(item.track_id) && !excludeTrackIds.includes(item.track_id)
|
||||
);
|
||||
|
||||
// Then filter by title+artist to avoid duplicates from compilations, live albums, etc.
|
||||
const filtered = byId.filter(t => !isDuplicateOfExisting(t));
|
||||
const filtered = byId.filter(item => !isDuplicateOfExisting(item));
|
||||
|
||||
// Also deduplicate within the pool itself (same song from different albums)
|
||||
const seenKeys = new Set<string>();
|
||||
return filtered.filter(t => {
|
||||
const key = makeTrackKey(t.title, t.artist_name);
|
||||
return filtered.filter(item => {
|
||||
const key = makeTrackKey(item.title, item.artist_name);
|
||||
if (seenKeys.has(key)) return false;
|
||||
seenKeys.add(key);
|
||||
return true;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
const selectedTagName = $derived.by(() => {
|
||||
if (!selectedTag) return null;
|
||||
const tag = tags.find(t => t.slug === selectedTag);
|
||||
const tag = tags.find(item => item.slug === selectedTag);
|
||||
return tag?.name ?? null;
|
||||
});
|
||||
|
||||
|
||||
@@ -405,10 +405,10 @@
|
||||
let filteredTracks = $derived.by(() => {
|
||||
if (!trackSearch.trim()) return favoriteTracks;
|
||||
const query = trackSearch.toLowerCase();
|
||||
return favoriteTracks.filter(t =>
|
||||
t.title.toLowerCase().includes(query) ||
|
||||
t.performer?.name?.toLowerCase().includes(query) ||
|
||||
t.album?.title?.toLowerCase().includes(query)
|
||||
return favoriteTracks.filter(track =>
|
||||
track.title.toLowerCase().includes(query) ||
|
||||
track.performer?.name?.toLowerCase().includes(query) ||
|
||||
track.album?.title?.toLowerCase().includes(query)
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -204,11 +204,11 @@
|
||||
// Playlist suggestions: adaptive artist selection (quantity scales with playlist size,
|
||||
// mix of top artists for coherence + random artists for discovery)
|
||||
const playlistArtists = $derived(
|
||||
extractAdaptiveArtists(tracks.filter(t => !t.isLocal))
|
||||
extractAdaptiveArtists(tracks.filter(track => !track.isLocal))
|
||||
);
|
||||
// Track IDs to exclude from suggestions (already in playlist)
|
||||
const excludeTrackIds = $derived(
|
||||
tracks.filter(t => !t.isLocal).map(t => t.id)
|
||||
tracks.filter(track => !track.isLocal).map(track => track.id)
|
||||
);
|
||||
|
||||
let loading = $state(true);
|
||||
@@ -999,7 +999,7 @@
|
||||
|
||||
// Calculate total count: must reach the highest local position
|
||||
const maxLocalPosition = localTracks.length > 0
|
||||
? Math.max(...localTracks.map(t => t.playlist_position))
|
||||
? Math.max(...localTracks.map(lt => lt.playlist_position))
|
||||
: -1;
|
||||
const minTotalCount = tracks.length + localTracks.length;
|
||||
const totalCount = Math.max(minTotalCount, maxLocalPosition + 1);
|
||||
|
||||
Reference in new issue
Block a user