@@ -97,7 +97,8 @@ export class MarketplaceViewStateManager {
9797 // Only create new arrays if they exist and have items
9898 const allItems = this . state . allItems . length ? [ ...this . state . allItems ] : [ ]
9999 // Ensure displayItems is always an array, never undefined
100- const displayItems = this . state . displayItems ? [ ...this . state . displayItems ] : [ ]
100+ // If displayItems is undefined or null, fall back to allItems
101+ const displayItems = this . state . displayItems ? [ ...this . state . displayItems ] : [ ...allItems ]
101102 const tags = this . state . filters . tags . length ? [ ...this . state . filters . tags ] : [ ]
102103
103104 // Create minimal new state object
@@ -174,11 +175,20 @@ export class MarketplaceViewStateManager {
174175 break
175176 }
176177
178+ // Calculate display items based on current filters
179+ let newDisplayItems : MarketplaceItem [ ]
180+ if ( this . isFilterActive ( ) ) {
181+ newDisplayItems = this . filterItems ( [ ...items ] )
182+ } else {
183+ // No filters active - show all items
184+ newDisplayItems = [ ...items ]
185+ }
186+
177187 // Update allItems as source of truth
178188 this . state = {
179189 ...this . state ,
180190 allItems : [ ...items ] ,
181- displayItems : this . isFilterActive ( ) ? this . filterItems ( [ ... items ] ) : [ ... items ] ,
191+ displayItems : newDisplayItems ,
182192 isFetching : false ,
183193 }
184194
@@ -322,7 +332,17 @@ export class MarketplaceViewStateManager {
322332 // Always use the marketplace items from the extension when they're provided
323333 // This ensures fresh data is always displayed
324334 const items = [ ...marketplaceItems ]
325- const newDisplayItems = this . isFilterActive ( ) ? this . filterItems ( items ) : items
335+
336+ // Calculate display items based on current filters
337+ // If no filters are active, show all items
338+ // If filters are active, apply filtering
339+ let newDisplayItems : MarketplaceItem [ ]
340+ if ( this . isFilterActive ( ) ) {
341+ newDisplayItems = this . filterItems ( items )
342+ } else {
343+ // No filters active - show all items
344+ newDisplayItems = items
345+ }
326346
327347 // Update state in a single operation
328348 this . state = {
0 commit comments