-
Notifications
You must be signed in to change notification settings - Fork 47.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force DOM flush for printing purposes #17155
Comments
That's really strange how it seems to break the sandbox without any errors. Can you reproduce this with a non-hosted version, like with |
@aweary You can just download that sandbox (File->Export to ZIP) which already is CRA based app. I can confirm the same behavior when running it locally. |
I think this is likely the same problem as #16734. |
Yea, that seems highly likely. So I guess there isn't any viable workaround currently to have an in-app button for printing. That's bummer for touch devices with printing capabilities. |
@FredyC for what it’s worth, the bug should only exist in the development build. So theoretically you could ship it to production and it would work as expected. You’d just have to test the feature with a production build as well. Not ideal, but at least doable if it’s blocking you. |
That's definitely interesting realization, did not know about it. I tried to run a production build of that sandbox and it indeed does work. It's ok for us to disable the print button in development to avoid accidental freezes. If only it would be possible to force print styling for the whole page so it's possible to see how it will look like. I guess Ctrl+P will have to suffice :) Either way, thanks a lot at least for that. |
Two years ago there was issue #11876 about printing. Sync DOM flush was recommended by @gaearon. However, with the latest React this does not seem to work anymore. It even seems that it somehow breaks the application, no print preview is ever displayed and sandbox preview cannot be reloaded anymore. It feels like an endless loop or something.
https://codesandbox.io/s/youthful-brown-0b6ez
I wonder if there is a new recommended way how to force DOM flush for correct printing experience.
The text was updated successfully, but these errors were encountered: