From ede1615ab81e291c9d83e188b910e7d7c5415f54 Mon Sep 17 00:00:00 2001 From: alexsparkes Date: Tue, 3 Feb 2026 20:31:38 +0000 Subject: [PATCH] fix(ItemCard): clear local storage queues and refresh background on pack toggle --- .../marketplace/components/Items/Items.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/features/marketplace/components/Items/Items.jsx b/src/features/marketplace/components/Items/Items.jsx index bac14a98..b2db7ae3 100644 --- a/src/features/marketplace/components/Items/Items.jsx +++ b/src/features/marketplace/components/Items/Items.jsx @@ -103,9 +103,21 @@ function ItemCard({ onTogglePack(packId, newState); } - // Emit refresh event for quotes only (background will update on next interval) + // Clear queue when toggling pack state to prevent stale content if (item.type === 'quotes') { + // Clear quote queue + localStorage.removeItem('quoteQueue'); + localStorage.removeItem('currentQuote'); EventBus.emit('refresh', 'quote'); + } else if (item.type === 'photos') { + // Clear photo pack queue + localStorage.removeItem('photoPackQueue'); + localStorage.removeItem('currentPhoto'); + // Only refresh if background is currently blank/black to avoid jarring changes + const backgroundImage = document.getElementById('backgroundImage'); + if (!backgroundImage || !backgroundImage.style.backgroundImage) { + EventBus.emit('refresh', 'background'); + } } };