react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

React 19

Open alexandernanberg opened this issue 1 year ago • 5 comments

Fixes #2756

alexandernanberg avatar Jun 12 '24 13:06 alexandernanberg

🦋 Changeset detected

Latest commit: b190eb3ab86d4f2da5816e4e6b394c7acb5f191d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@react-pdf/renderer Major
@react-pdf/examples Patch
@react-pdf/e2e-node-cjs Patch
@react-pdf/e2e-node-esm Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jun 12 '24 13:06 changeset-bot[bot]

Currently both react-reconciler.development.js and react-reconciler.production.js are included in the bundle, which isn't optimal. I don't see any good alternative though, since jsx-runtime in dev requires dev specific APIs of the reconciler

We could move react-reconciler to a dependency and stop inlining it, but that could cause other issues (duplicate deps etc). Another option is to create separate prod and dev bundles, just like React does. Would be annoying to manage with both esm and cjs tho

alexandernanberg avatar Jun 13 '24 13:06 alexandernanberg

no solutions ?

joacub avatar Sep 22 '24 23:09 joacub

This is a solution for react19 at the expense of dropping support for all other versions for what I understand. Is that correct?

diegomura avatar Sep 23 '24 07:09 diegomura

Yes, that is my understanding. That said, I've not tested this branch with React 18

alexandernanberg avatar Sep 23 '24 12:09 alexandernanberg

Hi, is there an estimate of when this PR will be merged into the main branch? Our project kind of depends on this. Thanks in advance.

Ortieez avatar Nov 08 '24 10:11 Ortieez

@alexandernanberg is this updated to what's published in npm? I validated this code works for React 19 when installing from npm, but I'm working on a solution to support both the previous versions and 19 at the same time. I tried this code in my solution and there it fails and I'm not seeing the difference

diegomura avatar Nov 15 '24 01:11 diegomura

@alexandernanberg here's the branch where I'm pushing that. My idea is to ship both reconcilers, and dynamically use one or the other based on React version. Code there is the one included in this PR, but different structured because of that reason. However, when trying it out I get the following errors.

Did you get those on your testing by any chance? Would you have the time to take a look at my branch? I'm planning to add you as co-author of it anyways :) Thanks in advance

Screenshot 2024-11-15 at 02 45 19

diegomura avatar Nov 15 '24 01:11 diegomura

is this updated to what's published in npm?

Yes, but cut a new 4.0.0-canary-5 just to be sure. Still works as expected in my app.

Did you get those on your testing by any chance?

I don't remember exactly, but I did have some issues when trying to use the prod reconciler with dev react or vice versa, the prod bundles are slimmed down and don't include everything. The React packages use dynamic import/requires https://github.com/facebook/react/blob/main/packages/react-reconciler/npm/index.js

I'll take a look at your branch when I have some time to spare!

alexandernanberg avatar Nov 15 '24 07:11 alexandernanberg

Will close this in favor of https://github.com/diegomura/react-pdf/pull/2941 where I kept support for all the previous React versions too. @alexandernanberg thanks so much for posting this. It was very helpful. Added you as a co-author of the PR although I don't know your email to correctly add the commit message

diegomura avatar Nov 16 '24 21:11 diegomura

Cool, look forward to trying it out! Added my email to my GitHub profile but probably annoying to change it afterwards

alexandernanberg avatar Nov 17 '24 07:11 alexandernanberg

Not at all! Just did

Screenshot 2024-11-17 at 10 35 48

Thanks for the help man!

diegomura avatar Nov 17 '24 09:11 diegomura