Skip to content

fix: order to pdf logo print - #1132

Merged
smarcet merged 1 commit into
masterfrom
fix/orderpdf-inline-logo
Oct 21, 2026
Merged

smarcet merged 1 commit into
masterfrom
fix/orderpdf-inline-logo

Conversation

@santipalenque

@santipalenque santipalenque commented Oct 19, 2026 •

Copy link
Copy Markdown

https://app.clickup.com/t/9014802374/86bcmmft3

Summary by CodeRabbit

  • Bug Fixes
    • Invoice PDFs now correctly include the header image when downloaded.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 424a35ee-006e-4d00-b80d-97630fee9520
📥 Commits

Reviewing files that changed from the base of the PR and between 0c8cc01 and 8fc3f0f.

📒 Files selected for processing: 2
  • src/actions/__tests__/sponsor-purchases-actions.test.js
  • webpack.common.js

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

📝 Walkthrough

Webpack now inlines fn-invoice-header.png. The invoice-download test mocks the image as a PNG data URI and checks that PDF generation receives a matching logoSrc.

Changes: Invoice Header Image Bundling

Layer / File(s) Summary
Inline invoice header image and test its data URI
webpack.common.js, src/actions/__tests__/sponsor-purchases-actions.test.js
Webpack inlines fn-invoice-header.png and excludes it from the existing image file-loader rule. The invoice-download test mocks the image as a PNG data URI and expects PDF generation to receive a matching logoSrc.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: tomrndom

Merge Risk: ⚪ Minimal · up to 8fc3f

The invoice logo is bundled as a data URI and passed to the PDF image component. No merge-blocking issue was identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title describes the main change: fixing invoice logo rendering in the order PDF. It is related and specific enough despite awkward wording.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The narrowly scoped asset rules avoid loader conflicts, and no blocking issues remain.

No open issues 🎉

What changed in this PR

Fixes missing invoice PDF logos by embedding the header image instead of fetching it from the CDN.

Changes:

  • Inline the invoice logo and exclude it from the generic image loader.
  • Update the invoice download test to expect a PNG data URI.
File Description
webpack.common.js Adds isolated inline handling for the invoice logo.
src/​actions/​__tests__/​sponsor-purchases-actions.test.js Mocks the embedded logo and checks its data URI format.

Review effort: Balanced

@caseylocker caseylocker left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I built this branch in production mode and ran it against dev, generating invoices on the 2026 OCP Global Summit purchases list, and the ticket's acceptance checks pass:

  • No request to /images/fn-invoice-header.png for any of the 4 invoices I generated (checked the server access log)
  • Ran the forced cache fetch from the ticket, then generated 3 more invoices in the same tab without reloading. Every PDF has the logo embedded at 420x171.
  • No Not valid image extension warning in the console
  • The build emits no images/fn-invoice-header.png, and the logo is in main_*.js as a PNG data URI

One caveat: localhost has no Cloudflare Polish, so the forced fetch came back as HTML, not a real WebP. Since the PDF never requests that URL anymore, it shouldn't matter, but the true WebP path can only be confirmed on a Polish host.

One non-blocking ask on the test, inline below.

}));

// webpack inlines this asset as a data URI, the generic png file mock would return {}
jest.mock(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mocks the logo import as a data URI, so the assertion still passes if the webpack rule is removed. I reverted webpack.common.js to master and all three invoice tests stayed green. It does catch the action passing a URL directly, but it doesn't guard the actual fix. Should we add a small check that fails when the inline rule stops applying? For example, compile the logo import and assert a PNG data URI comes out with no emitted image file. Otherwise a future edit to the rule brings the bug back with CI green.

Side note: because moduleNameMapper sends every .png to fileMock.js, this jest.mock makes every image import in this test file return the logo string, not just the logo.

Comment thread webpack.common.js
},
{
// inline the invoice logo so react-pdf never fetches it (CDN may serve WebP, react-pdf caches failures)
test: /fn-invoice-header\.png$/,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, fine as is since the ticket allows it: the filename regex is repeated in the inline rule and in the exclude, so renaming the asset quietly falls back to file-loader. An ?inline import with a resourceQuery rule would avoid keeping the two in sync.

@smarcet smarcet left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smarcet
smarcet merged commit 3237572 into master Oct 21, 2026
10 checks passed
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.

4 participants