Repository navigation
feat(react-pdf): support $computed functions and custom directives - #396
Open
Kavishkagaya wants to merge 1 commit into
Open
Kavishkagaya wants to merge 1 commit into
Kavishkagaya wants to merge 1 commit into
Conversation
The react-pdf resolution context only carried `stateModel`, so every `$computed` expression resolved to undefined and custom directives were left as unresolved objects. - VisibilityProvider accepts `functions` and `directives` and adds them (directives as a memoized registry) to the resolution context - JSONUIProvider and createRenderer output forward both props - renderToBuffer/renderToStream/renderToFile accept both options and thread them through renderElement, including repeat children - Docs: list react-pdf among renderers that accept `directives`, and document the new options Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZtZvDfKrHFRWTuTqwNq26
Contributor
|
@Kavishkagaya is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@json-render/react-pdfbuilt its resolution context with onlystateModel, so every$computedexpression resolved toundefinedand custom directives were left as unresolved objects. This addsfunctionsanddirectivessupport, mirroring@json-render/react.VisibilityProvideracceptsfunctionsanddirectives, builds a memoized directive registry with core'screateDirectiveRegistry, and puts both in the contextJSONUIProviderandcreateRendereroutput accept and forward both propsrenderToBuffer/renderToStream/renderToFileaccept both options and pass them throughrenderElement, including repeat childrenNo changes to core or other renderers.
Tests
renderer.test.tsx:$computedviaJSONUIProvider+Renderer, a custom directive, a directive wrapping$computed, and$computedwith$itemargs per repeat iterationrender.test.tsx: the same cases throughrenderToBufferThe new tests fail without the fix and pass with it.
check-types,lintand the react-pdf/core vitest suites pass.Docs
directives.mdx: lists React PDF among renderers that acceptdirectivesapi/react-pdf.mdx, package README and skill: documentfunctions/directivesdocs-baseline.json: refreshed hashes for the two edited pages (pnpm --filter web test:routespasses, 122/122)