-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
removeAfterPrint
doesn't wait for promise returned from print
callback
#616
Comments
Hey, thanks for the detailed report, it's a good catch! I think the fix is straightforward: lines 146-150 need to moved to be within the different blocks, might make a helper for them. An I'll get a fix for this specific issue out later tonight! |
Fix should be available in Note that I also added in calling of I also did some general package cleanup 🥳 |
Thank you for the quick fix! I just tested it, works perfectly. 👍 |
When
removeAfterPrint
is set totrue
and a customprint
callback is provided, the iframe is already removed before the promise returned from theprint
callback resolves.Minimal reproducing example:
This produces the error
because
iframe.contentWindow === null
wheniframe.contentWindow.print()
is invoked.As a workaround, one can set
removeAfterPrint: false
and remove the iframe manually in theprint
callback.The reason for this behavior is that while here
this.handleRemoveIframe()
is only called when the promise resolves, here it is still called synchronously.The same problem occurs with the
onAfterPrint
callback, which is also called without waiting for the promise to resolve.The text was updated successfully, but these errors were encountered: