MatthewHerbst / react-to-print

Print React components in the browser. Supports Chrome, Safari, Firefox and EDGE
MIT License
2.06k stars 221 forks source link

Warning: findDOMNode is deprecated outside StrictMode. #706

Open keyboy21 opened 4 months ago

keyboy21 commented 4 months ago

Hi, Has any updates to remove findDOMNode. In react 18.3 adds warnings for deprecate this API and in v19 will be removed.

thanks.

Prev related issue: https://github.com/MatthewHerbst/react-to-print/issues/282

MatthewHerbst commented 4 months ago

Hey, thanks for raising this. I saw the patch notes the other day and was like, whelp, that's going to be a fun one 😄 I believe the change here might require us to make a breaking change to the type of our content prop. Not totally sure on that one. I'll look into this next weekend and report back. I wouldn't mind making a breaking change honestly, there are a few changes that I've been meaning to make for a while that would require a breaking change and this might finally be an excuse to do that

RISHIKESHk07 commented 3 months ago

@MatthewHerbst @yusuf-saydullayev any update on this ?

MatthewHerbst commented 3 months ago

Currently working on v3 of this library which will introduce some long needed breaking changes that will also allow supporting React 19 properly. I expect to have a beta release out by the end of the weekend

MatthewHerbst commented 2 months ago

Removing findDOMNode is proving more challenging than I had expected. Getting the underlying DOM Element, not the React component wrapping it, is proving to be a PITA. Still working on this, delayed getting a beta out by a few days

Dillpickleschmidt commented 2 months ago

Removing findDOMNode is proving more challenging than I had expected. Getting the underlying DOM Element, not the React component wrapping it, is proving to be a PITA. Still working on this, delayed getting a beta out by a few days

Has the beta been released somewhere? I apologize if you're still working on it, just trying to make sure I'm not crazy for not seeing it anywhere since you wrote this 2 weeks ago.

MatthewHerbst commented 2 months ago

You're not crazy, I'm still fighting with it unfortunately, it's a pretty core change to how this library operates. Looking forward to the long weekend to get this over the finish line, at least with some sort of v3-alpha release

MatthewHerbst commented 2 months ago

Update: I went down a rabbit hole trying to also get an ESM build out finally as part of v3. I think I'm going to give that up for now and just push the fix for React 19, targeting getting a release out this evening unless I run into some other issue. Will keep y'all updated. It's just me on this project, so I appreciate everyone's patience

RADesai commented 2 months ago

Your efforts are appreciated @MatthewHerbst

raffidahmad commented 2 months ago

react-draggable has an alternative to findDOMnode by using the ref, maybe that could help?

MatthewHerbst commented 2 months ago

Alright friends, the day has arrived! Please give v3.0.0-beta-1 (npm install react-to-print@beta) a shot and let me know how it works for you. There are a signifiant number of breaking changes though they should be fairly straightforward to migrate. Feedback is massively appreciated. Thank you all for your patience

Alexandredc commented 1 month ago

Thank you @MatthewHerbst 🎉 Migration is very easy !

MatthewHerbst commented 1 month ago

Going to let v3 beta bake for the rest of the week. If all is well after that I'll promote this out of beta this coming weekend

strarsis commented 1 month ago

Awesome!