Skip to content

Commit

Permalink
filter out disabled items
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpyp committed Feb 21, 2025
1 parent 2edfb7d commit 22f3142
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/lib/Item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ const itemDataFromRawItemNullable = (raw: any): ItemData | null => {

export const Item = {
byId(id: number): ItemData {
const item = rawItems.find((item) => item.id === id);
const item = rawItems.find((item) => item.id === id && !item.disabled);
if (!item) throw new Error(`Item with id ${id} not found`);
return itemDataFromRawItem(item);
},
byIdNullable(id: number): ItemData | null {
const item = rawItems.find((item) => item.id === id);
const item = rawItems.find((item) => item.id === id && !item.disabled);
if (!item) return null;
return itemDataFromRawItemNullable(item);
},
Expand Down

0 comments on commit 22f3142

Please sign in to comment.