[BUG]: Invoices with the same date are sorted out of order (ids compared as strings)
Maintainers usually reply within 2 days
@anshulchikhale30-p is already working on this.
Since Nov 7, 2026.
- #347 by @anshulchikhale30-p — open
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- frontend
Research direction
Start in frontend/src/utils/invoiceFilterSortHelpers.js at the comparator’s tie-breaker and trace how the default date sort uses it. Add the numeric-id ordering described in the issue, then cover the 9-to-10 boundary in frontend/tests/utils/invoiceFilterSortHelpers.test.js. Done when tied invoices sort by numeric id and the focused unit test passes.
Written by the indexing model from the issue text.
Description
Bug Description
When two invoices tie on the sort key, filterAndSortInvoices breaks the tie with String(a.id).localeCompare(String(b.id)). Invoice ids are BigInts, so they are compared as text and "10" sorts before "9".
This affects the default table view (sort by date, descending):
- All invoices created in one batch share the same
issueDate(CreateInvoicesBatch.jsxuses a singleissueDatefor every row). - On-chain-only stubs have
issueDate: null, so they all tie at0.
File: frontend/src/utils/invoiceFilterSortHelpers.js (tie-breaker at the end of the sort comparator)
Expected behavior
Invoices that tie on the sort key should be ordered by their numeric id.
Proposed fix
Compare ids numerically in the tie-breaker:
cmp = String(a.id ?? "").localeCompare(String(b.id ?? ""), undefined, { numeric: true });
and add a unit test in frontend/tests/utils/invoiceFilterSortHelpers.test.js covering ids that cross a digit boundary (9 → 10).
Steps to Reproduce
const d = "2026-10-20T00:00:00";
const invoices = [8n, 9n, 10n, 11n].map((id) => ({ id, issueDate: d, amountDue: "1" }));
filterAndSortInvoices(invoices).map((i) => String(i.id));
// Actual: ["9", "8", "11", "10"]
// Expected: ["11", "10", "9", "8"]
Or in the UI: create a batch of 10+ invoices and open the Sent/Received table. The order breaks where ids go from one digit to two digits.
I would like to work on this issue.
Logs and Screenshots
No response
Environment Details
No response
Impact
Critical - Application is unusable
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
- Dominant language
- JavaScript
- Stars
- 13
- Forks
- 62
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 18
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from StabilityNexus/Chainvoice
-
[BUG]: Smart Batch Suggestions ignore active filters and select invoices hidden from the tablePossibly taken @anshulchikhale30-p claimed this 15 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
StabilityNexus/Chainvoice#331 · 1 comment ·
Maintainers usually reply within 2 days
-
[BUG]: Stale token-list requests can overwrite state after switching networksPossibly taken @JANAKIRAM218 claimed this 10 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
StabilityNexus/Chainvoice#325 · 1 comment ·
Maintainers usually reply within 2 days
-
[BUG]: Invoice PDF totals overlap the footer with 10 line itemsMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
StabilityNexus/Chainvoice#310 · 4 comments ·
Maintainers usually reply within 2 days
-
[BUG]: Batch invoice summary truncates displayed amount precision to four decimal placesPossibly taken @JANAKIRAM218 claimed this 29 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
StabilityNexus/Chainvoice#294 · 2 comments ·
Maintainers usually reply within 2 days
-
[BUG]: PDF export shows January 1970 for missing invoice datesPossibly taken @anshulchikhale30-p claimed this 18 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
StabilityNexus/Chainvoice#265 · 3 comments ·
Maintainers usually reply within 2 days
All issues in StabilityNexus/Chainvoice
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 Under an hour Newbie friendliness 82/100
Leonxlnx/taste-skill#216 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
all-contributors/cli#690 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day