Skip to content

fix(invoice): Change Regenerate invoice components to retrieve preview invoice#3564

Open
tiagolupepic wants to merge 19 commits into
mainfrom
feat/change-invoice-regenerate-to-use-draft-query
Open

fix(invoice): Change Regenerate invoice components to retrieve preview invoice#3564
tiagolupepic wants to merge 19 commits into
mainfrom
feat/change-invoice-regenerate-to-use-draft-query

Conversation

@tiagolupepic
Copy link
Copy Markdown

This commit updates the CustomerInvoiceRegenerate and CreateInvoice to use a draft invoice query.

Recently, we detected a issue with a customer.

We have a current problem related to taxes applied in Invoice, Fee and its relations, applied_taxes.
These taxes are generated during the invoice generation and they keep persisted, they're based
on customer data, when the customer data changes, the previous applied taxes are not affected.

However, we have a scenario when customer changes their taxes and they want to regenerate invoices.
During the process to display the invoice information, frontend ask the invoice details using the invoice GraphQL query and as expected, we're still showing the applied taxes based on previous customer information.

We have a getlago/lago-api#5237 and introducing the GraphQL query and,
in this PR we're changing the CustomerInvoiceRegenerate and CreateInvoice to use the "preview" state.

Also, we're removing the extra query of fees because the fees are nested in the invoice draft query
and we don't need an extra query.

Dependency: getlago/lago-api#5237

Comment thread src/pages/CustomerInvoiceRegenerate.tsx Outdated
@tiagolupepic tiagolupepic force-pushed the feat/change-invoice-regenerate-to-use-draft-query branch from e38e508 to f15ef31 Compare June 2, 2026 16:22
@tiagolupepic tiagolupepic force-pushed the feat/change-invoice-regenerate-to-use-draft-query branch from baac04e to 9e99d33 Compare June 3, 2026 09:47
@tiagolupepic tiagolupepic force-pushed the feat/change-invoice-regenerate-to-use-draft-query branch from 9e99d33 to 8002311 Compare June 3, 2026 09:55
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 3, 2026

@tiagolupepic tiagolupepic force-pushed the feat/change-invoice-regenerate-to-use-draft-query branch 6 times, most recently from 6d387dc to 04a7948 Compare June 3, 2026 15:04
@tiagolupepic tiagolupepic force-pushed the feat/change-invoice-regenerate-to-use-draft-query branch 3 times, most recently from 0a39f4d to fc68dbc Compare June 3, 2026 15:33
avoid conflicts with cached fee fragments

And also improve the cache policy
@tiagolupepic tiagolupepic force-pushed the feat/change-invoice-regenerate-to-use-draft-query branch from fc68dbc to c3e7211 Compare June 3, 2026 15:43
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.

2 participants