Skip to content

fix(orders): fix nullish coalescing on toString in getNFTItems#1928

Merged
ryanio merged 1 commit intomainfrom
fix/orders-nullish-coalescing
Mar 11, 2026
Merged

fix(orders): fix nullish coalescing on toString in getNFTItems#1928
ryanio merged 1 commit intomainfrom
fix/orders-nullish-coalescing

Conversation

@ryanio
Copy link
Collaborator

@ryanio ryanio commented Mar 11, 2026

Summary

  • Fix quantities[index].toString() ?? "1"quantities[index]?.toString() ?? "1" in getNFTItems
  • Add tests verifying quantity default fallback behavior

When quantities[index] is undefined (e.g., quantities array shorter than nfts array), calling .toString() throws a TypeError before the ?? "1" fallback can execute. Optional chaining fixes this so the default correctly triggers.

Based on #1922 by @Viktohblake — thank you for catching this bug!

Test plan

  • Verify npm test passes
  • Confirm bulk listing without explicit quantities defaults to "1"
  • Confirm bulk listing with explicit quantities uses provided values

🤖 Generated with Claude Code

quantities[index].toString() throws TypeError when quantities[index]
is undefined, making the ?? "1" fallback dead code. Use optional
chaining so the default actually triggers.

Co-Authored-By: viktohblake <damanygt@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ryanio ryanio merged commit 88e11a4 into main Mar 11, 2026
8 checks passed
@ryanio ryanio deleted the fix/orders-nullish-coalescing branch March 11, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant