Skip to content

v0.9.1

Latest

Choose a tag to compare

@danmolitor danmolitor released this 07 Apr 03:54

0.9.1 — React Compiler compatibility

Patch release. No breaking changes.


What's fixed

If you enabled React Compiler in your Next.js app (or any
React app) and passed a component reference directly to a
Forme entry point like pdfResponse(MyInvoice), you'd get
a cryptic Invalid hook call error with no indication of
what caused it or how to fix it.

Root cause: React Compiler injects a useMemoCache hook
into compiled functions. Forme's serializer calls user
components as plain functions outside of React's render
cycle — which is illegal for any function containing hooks.

Fix: 0.9.1 catches that error at every call site and
rethrows with a clear, actionable message:
Component "MyInvoice" appears to be compiled by React
Compiler, which injects hooks that cannot run outside of
React's render cycle.
Fix: Add 'use no memo' at the top of the function to opt it out:
function MyInvoice() {
'use no memo';
return ...;
}
Alternatively, wrap it in an inline arrow:
pdfResponse(() => )

The diagnostic is wired into:

  • @formepdf/reactserialize() (covers all consumers)
  • @formepdf/nextrenderPdf(), pdfResponse()
  • @formepdf/honopdfResponse()
  • @formepdf/resendsendPdf(), renderAndAttach()

Who needs this

Anyone using React Compiler (reactCompiler: true in
Next.js 16, or the experimental Vite plugin) who passes
component references directly to Forme entry points.

The common inline pattern was already fine:

// ✅ This was never affected
pdfResponse(() => <MyInvoice data={data} />)

Only the direct reference form tripped the bug:

// ❌ This threw a cryptic error in 0.9.0
pdfResponse(MyInvoice)

Other changes

  • Docker image formepdf/forme now bases on
    formepdf/rasterizer:0.9.1
  • RELEASE.md updated with --provenance=true --sbom=true
    flags for supply-chain attestations on Docker builds

Upgrade

npm install @formepdf/react@0.9.1 @formepdf/core@0.9.1

# Plus any framework integrations you use:
npm install @formepdf/next@0.9.1
npm install @formepdf/hono@0.9.1
npm install @formepdf/resend@0.9.1

Docker: formepdf/forme:0.9.1, formepdf/rasterizer:0.9.1
Crates: forme-pdf = "0.9.1"