You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
P0Critical issue that needs to be resolved immediatelybughas prA PR has been created to address this issuein-progressprintIssues with breakpoints when printing
What is the use-case or motivation for changing an existing behavior?
The screen looks incorrect when printing completes
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
I have tested in the latest Angular 8 and 9 releases with FlexLayout 8.0.0-beta.27 and 9.0.0-beta.29 respectively.
Is there anything else we should know?
Reacted by Alex vG, Kevin Schneider, Ermanno, paco76, Shih-Chun (Joyce) Huang, Caleb Miracle, Amirroracle, Stefan Lässer, Ken, ouassimBenMosbah and 11 more
I think the activatedBreakpoints are not properly restored in stopPrinting()
edit: yes, I can confirm, activatedBreakpoints are not restored correctly. If you just dump=[...target.activatedBreakpoints] in startPrinting() and set target.activatedBreakpoints = dump in stopPrinting() it works in my case. This also affects other breakpoint styles like fxFlex.lg-md etc.
this was my case:
target.activatedBreakpoints.map((x)=>x.alias) the correct array in startPrinting(): ["xl", "gt-lg", "gt-md", "gt-sm", "gt-xs"]
this.deactivations.map((x)=>x.alias) the faulty array in stopPrinting(): ["xs", "lt-sm", "lt-md", "lt-lg", "lt-xl", "xl", "gt-lg", "gt-md", "gt-sm", "gt-xs"]
CommonMaterialModule is my only module that imports (and re-exports) FlexLayoutModule.
Reacted by Jones Prabu, ngocdiep, Eric Carr, Guillaume Seguin, Viktor Pylypenko, Andrei Mardare, Nataraj, Patrick Beal, Florian Neumann, Arash Ghasemi rad and 14 more
Reacted by Abdulllah-Fal
Reacted by Jones Prabu, Jim Mackenzie, Patrick Beal, borox2k, Daniel Tartaglia, Gustavo Miranda, Jorge Aires, nusilgon, Laura A. Dalmolin, Michal and 2 more
Reacted by Jones Prabu, ouassimBenMosbah, Patrick Beal, Florian Neumann, Daniel Tartaglia, Gustavo Miranda, Jorge Aires, nusilgon, Laura A. Dalmolin and Abdulllah-Fal
Reacted by Gustavo Miranda, Jorge Aires, nusilgon, Laura A. Dalmolin and Abdulllah-Fal
Same bug here. I'm using ^11.0.0-beta.33 facing this error. even if I use *ngIf to remove elements before calling window.print, all elements use fxFlex.sm value.
Yes, Thank you @FloNeu and many thanks to @alex-vg for the solution. I imported this module in my root module and problem fixed for the entire solution. Hope to see that the problem is fixed in the very next version
So I found out what the issue was, and for anyone else also running into the same issue where the print preview is malformed, it is due to centering using fxLayoutAlign. Basically instead of using fxLayoutAlign="center center" I would replace it with this in your component style:
First of all, thank you so much to @alex-vg for the patch that helped users while we tracked this issue. Contributions like this are invaluable and greatly appreciated by the entire team.
Now, the issue at hand, it turns out the root cause was a lot simpler than I thought it was going to be, and was just an issue of array reference assignment. In essence, we were restoring breakpoints correctly, but then immediately unassigning them. This led to the outcome all of you were seeing during print, which was obviously less than optimal. We've patched this in #1379, which has landed in the nightly release for those who'd like to try it out and report back. If not, it'll be in the next minor/major release.
Thank you all for your patience, and again, thank you @alex-vg.
Ok quick followup here; my solution worked about half-way. The other half involved incorporating much of what @alex-vg's solution put forth. They were correct that our accumulation routine was not working, and that a better method is to just capture the breakpoints before the event and restore them after. Unfortunately, this went against the intention of the accumulator in the first place (we essentially had that approach to begin with); we support beforeprint and afterprint events as well for browsers that have quirky print behaviors. Therefore, in #1380, I have adapted this approach so that it works in both instances. This should close out the issue, and in testing with the docs site I think we're in the clear.
P0Critical issue that needs to be resolved immediatelybughas prA PR has been created to address this issuein-progressprintIssues with breakpoints when printing
Activity
alex-vg commentedon Apr 3, 2020
I think the activatedBreakpoints are not properly restored in stopPrinting()
edit: yes, I can confirm, activatedBreakpoints are not restored correctly. If you just
dump=[...target.activatedBreakpoints]instartPrinting()and settarget.activatedBreakpoints = dumpinstopPrinting()it works in my case. This also affects other breakpoint styles likefxFlex.lg-mdetc.this was my case:
target.activatedBreakpoints.map((x)=>x.alias)the correct array instartPrinting():["xl", "gt-lg", "gt-md", "gt-sm", "gt-xs"]this.deactivations.map((x)=>x.alias)the faulty array instopPrinting():["xs", "lt-sm", "lt-md", "lt-lg", "lt-xl", "xl", "gt-lg", "gt-md", "gt-sm", "gt-xs"]alex-vg commentedon Apr 3, 2020
My little dirty hack until this gets resolved....
CommonMaterialModule is my only module that imports (and re-exports) FlexLayoutModule.
PsyStorm25 commentedon May 20, 2020
@alex-vg thank you, your temporary fix works for me.
Seems this bug is a duplicate of #1228 (or the opposite).
lambertwen commentedon May 22, 2020
@alex-vg much appreciated! this fix did the trick.
qliqdev commentedon Jul 15, 2020
I'm using
"@angular/flex-layout": "^10.0.0-beta.32"and the problem is still exists in todays.jnfaerch commentedon Nov 12, 2020
Just chiming in as this bug is still present. Thx to @alex-vg for the temporary fix 👍
FloNeu commentedon Mar 4, 2021
Hello! Also ran into this bug - and was searching for hours - any reason this isn't resolved yet - the hack, did solf the issue for now!
tyeety commentedon Mar 17, 2021
Same bug here. I'm using ^11.0.0-beta.33 facing this error. even if I use
*ngIfto remove elements before callingwindow.print, all elements usefxFlex.smvalue.FloNeu commentedon Mar 17, 2021
@tyeety use the fix from @alex-vg - it restores the correct breakpoints after the print-window closes
tyeety commentedon Mar 17, 2021
Yes, Thank you @FloNeu and many thanks to @alex-vg for the solution. I imported this module in my root module and problem fixed for the entire solution. Hope to see that the problem is fixed in the very next version
borox2k commentedon Apr 27, 2021
@alex-vg thanks, your workaround still works 2021 angular 11
gracias
Amirroracle commentedon May 7, 2021
The issue with @alex-vg 's solution is that it restores the breakpoint but I found that the print preview is now broken instead.
alex-vg commentedon May 7, 2021
Which breakpoints are active when printing?
In case you want to set the print breakpoints: https://github.com/angular/flex-layout/blob/master/docs/documentation/BreakPoints.md
The workaround just restores breakpoints, it does not write print breakpoints on print-begin.
Amirroracle commentedon May 10, 2021
@alex-vg
So I found out what the issue was, and for anyone else also running into the same issue where the print preview is malformed, it is due to centering using
fxLayoutAlign. Basically instead of usingfxLayoutAlign="center center"I would replace it with this in your component style:rdanielst commentedon May 20, 2021
Thank you very much @alex-vg !!!!!
1 remaining item
dhammond371 commentedon Dec 14, 2021
Problem still exists
CaerusKaru commentedon Dec 29, 2021
First of all, thank you so much to @alex-vg for the patch that helped users while we tracked this issue. Contributions like this are invaluable and greatly appreciated by the entire team.
Now, the issue at hand, it turns out the root cause was a lot simpler than I thought it was going to be, and was just an issue of array reference assignment. In essence, we were restoring breakpoints correctly, but then immediately unassigning them. This led to the outcome all of you were seeing during print, which was obviously less than optimal. We've patched this in #1379, which has landed in the nightly release for those who'd like to try it out and report back. If not, it'll be in the next minor/major release.
Thank you all for your patience, and again, thank you @alex-vg.
CaerusKaru commentedon Dec 29, 2021
Ok quick followup here; my solution worked about half-way. The other half involved incorporating much of what @alex-vg's solution put forth. They were correct that our accumulation routine was not working, and that a better method is to just capture the breakpoints before the event and restore them after. Unfortunately, this went against the intention of the accumulator in the first place (we essentially had that approach to begin with); we support beforeprint and afterprint events as well for browsers that have quirky print behaviors. Therefore, in #1380, I have adapted this approach so that it works in both instances. This should close out the issue, and in testing with the docs site I think we're in the clear.
Sergiobop commentedon Jan 28, 2022
@CaerusKaru Thank you! Can we have a minor release with the patch?
CaerusKaru commentedon Jan 28, 2022
Patch release 13.0.0-beta.37 cut. Please let us know it you have any further issues.
angular-automatic-lock-bot commentedon Feb 28, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.