fix(adr-001): replace t variable names in store callbacks
Rename t -> item/track in .map()/.filter() callbacks in favoritesStore.ts and queueStore.ts to comply with ADR-001 and prevent intermittent PostCSS extraction failures. cc
This commit is contained in:
2 files changed
+13
-13
No files matched your search
@@ -123,7 +123,7 @@ export async function syncFromApi(): Promise<void> {
|
||||
const items = response?.tracks?.items ?? [];
|
||||
if (items.length === 0) break;
|
||||
|
||||
allTrackIds.push(...items.map(t => t.id));
|
||||
allTrackIds.push(...items.map(item => item.id));
|
||||
offset += items.length;
|
||||
|
||||
// Check if we've fetched all
|
||||
|
||||
@@ -152,7 +152,7 @@ export async function updateLocalCopiesSet(): Promise<void> {
|
||||
}
|
||||
|
||||
try {
|
||||
const trackIds = queue.map(t => parseInt(t.id)).filter(id => !isNaN(id));
|
||||
const trackIds = queue.map(track => parseInt(track.id)).filter(id => !isNaN(id));
|
||||
if (trackIds.length === 0) {
|
||||
tracksWithLocalCopies = new Set();
|
||||
return;
|
||||
@@ -164,10 +164,10 @@ export async function updateLocalCopiesSet(): Promise<void> {
|
||||
tracksWithLocalCopies = new Set(localIds);
|
||||
|
||||
// Update queue availability
|
||||
queue = queue.map(t => {
|
||||
const numId = parseInt(t.id);
|
||||
queue = queue.map(track => {
|
||||
const numId = parseInt(track.id);
|
||||
return {
|
||||
...t,
|
||||
...track,
|
||||
available: isNaN(numId) || localTrackIds.has(numId) || tracksWithLocalCopies.has(numId)
|
||||
};
|
||||
});
|
||||
@@ -188,7 +188,7 @@ export async function syncQueueState(): Promise<void> {
|
||||
const queueState = await invoke<BackendQueueState>('v2_get_queue_state');
|
||||
|
||||
// Get track IDs for local copy check
|
||||
const trackIds = queueState.upcoming.map(t => t.id);
|
||||
const trackIds = queueState.upcoming.map(track => track.id);
|
||||
|
||||
// Check local copies if in offline mode
|
||||
let localCopies = new Set<number>();
|
||||
@@ -205,13 +205,13 @@ export async function syncQueueState(): Promise<void> {
|
||||
}
|
||||
|
||||
// Convert backend queue tracks to frontend format
|
||||
queue = queueState.upcoming.map(t => ({
|
||||
id: String(t.id),
|
||||
artwork: t.artwork_url || '',
|
||||
title: t.title,
|
||||
artist: t.artist,
|
||||
duration: formatDuration(t.duration_secs),
|
||||
available: !isOfflineMode || localTrackIds.has(t.id) || localCopies.has(t.id)
|
||||
queue = queueState.upcoming.map(track => ({
|
||||
id: String(track.id),
|
||||
artwork: track.artwork_url || '',
|
||||
title: track.title,
|
||||
artist: track.artist,
|
||||
duration: formatDuration(track.duration_secs),
|
||||
available: !isOfflineMode || localTrackIds.has(track.id) || localCopies.has(track.id)
|
||||
}));
|
||||
|
||||
queueTotalTracks = queueState.total_tracks;
|
||||
|
||||
Reference in new issue
Block a user