Skip to content

Commit

Permalink
fix(aih): handle edge case for next up resource retrieval in get-next…
Browse files Browse the repository at this point in the history
…up-resource-from-list.ts
  • Loading branch information
vojtaholik committed Jan 21, 2025
1 parent af2b3da commit 2b1623e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/ai-hero/src/utils/get-nextup-resource-from-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export function getNextUpResourceFromList(
(r) => r.resource.id === currentResourceId,
)

if (!currentResourceIndexFromList) return null

const nextUpIndex = currentResourceIndexFromList + 1
const nextUpIndex = currentResourceIndexFromList
? currentResourceIndexFromList + 1
: 1
const nextUpResource = list?.resources?.[nextUpIndex]

return nextUpResource || null
Expand Down

0 comments on commit 2b1623e

Please sign in to comment.