[BUG] Confirmed invoices can lose their payload when local persistence fails

Open
#311 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript
Domain
backend, database

Research direction

Read the failure paths in frontend/src/page/CreateInvoice.jsx lines 698–716, frontend/src/page/CreateInvoicesBatch.jsx lines 737–752, and frontend/src/page/SentInvoice.jsx lines 195–228. Trace what happens after storeInvoice() fails, then verify that confirmed invoice details remain recoverable and that batch results distinguish saved invoices from failures. Runtime reproduction and frontend tests are not yet available because the required Jest dependencies are missing.

Written by the indexing model from the issue text.

Description

bug
Bug Description

[BUG] Confirmed invoices can lose their payload when local persistence fails

Summary

A confirmed invoice can lose its sender-side invoice details if the subsequent IndexedDB write fails. The batch creation flow can also report success and navigate away even when an individual invoice was not saved locally.

Affected files

  • frontend/src/page/CreateInvoice.jsx — lines 698–716
  • frontend/src/page/CreateInvoicesBatch.jsx — lines 737–752
  • frontend/src/page/SentInvoice.jsx — lines 195–228

Steps to reproduce

  1. Create an invoice and wait for its blockchain transaction to confirm.
  2. Simulate an IndexedDB write failure in the subsequent storeInvoice() call.
  3. Leave or reload the page and open Sent Invoices.

For batch creation, repeat the scenario with one invoice's local persistence failing while the other invoices succeed.

Actual behavior

  • Single invoice: The application displays a storage-failure warning, but the failure branch provides no immediate recovery or export action. If the page is reloaded or left, the in-memory invoice payload can be lost.
  • Batch creation: A failed storeInvoice() call is caught and logged, but the batch can still display a success message and navigate away.
  • Afterward: Sent Invoices may show an on-chain-only record without the original invoice details, preventing the sender from resending the full payload.

The blockchain stores the invoice data hash rather than the complete invoice payload. A later IndexedDB backup cannot include a record that was never saved locally.

Expected behavior

When local persistence fails after a transaction is confirmed, the application should preserve a recoverable copy of the invoice details or provide a clear retry/export recovery action.

For batch creation, the application should identify invoices whose local persistence failed and clearly distinguish partial success from complete success.

Verification status

The failure paths are supported by source-code inspection. Runtime reproduction and frontend tests have not yet been completed because the inspected checkout lacks the required Jest dependencies.

Steps to Reproduce

No response

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from StabilityNexus/Chainvoice

All issues in StabilityNexus/Chainvoice

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.