-
Notifications
You must be signed in to change notification settings - Fork 768
fxLayoutWrap not working with Angular Universal #430
Comments
Could you paste your code as well? |
Please test the below code with Server Side Rendering and observe the initial load, before preboots sync the changes. <div fxLayout fxLayoutWrap class="table-grid touched">
<div fxFlex.xs="50%" fxFlex="20%"> Item 1 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 1 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 2 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 2 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 3 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 3 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 4 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 4 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 5 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 5 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 6 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 6 Value </div>
</div> |
Might be fixed by #466. The latest beta of angular/flex-layout blocked certain methods from being used with Universal, and that PR reverses that change. If/when that PR gets merged, pull the latest nightly build and see if that fixes it. |
As a side note, the |
Can you please also share, what are the alternatives to fxLayoutWrap? |
@naveedahmed1 The deprecation notice is listed here: flex-layout/src/lib/api/flexbox/layout-wrap.ts Lines 25 to 35 in cc12733
As shown on the So, in your case, you would change |
Thank you so much @CaerusKaru , its awesome :) |
@naveedahmed1 The fixes from #466 have been merged into the latest nightly build. Does that fix your problem? |
Yes, its fixed now. Thank you! |
Great, this issue can be closed. |
@CaerusKaru I think the latest nightly build has introduced this issue again. Can you please check? Please also confirm if support for fxLayoutWrap has been removed? I had to update |
Please provide a minimal reproduction repo that I can confirm. |
Can you please try below with SSR enabled and observe the behavior. Before the client side code takes control all blocks are shown in one row when client side code is activated it is displayed correctly. <div fxLayout="row wrap">
<div fxFlex.xs="50%" fxFlex="20%"> Item 1 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 1 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 2 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 2 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 3 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 3 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 4 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 4 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 5 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 5 Value </div>
<div fxFlex.xs="50%" fxFlex="20%"> Item 6 </div>
<div fxFlex.xs="50%" fxFlex="30%"> Item 6 Value </div>
</div> |
@naveedahmed1 In order to exactly replicate the conditions you're seeing, we need a repo to clone and test. Code snippets are insufficient. |
@CaerusKaru thank you for your reply. Can you please check it with https://github.com/angular/universal-starter ?
Run project using below command: try refreshing the page few times, and you will notice that before the client side code takes control all divs are shown in one row. |
@naveedahmed1 Confirmed the issue, thanks for the detailed steps. Can you also tell me what was the last nightly build that this worked correctly? |
I think |
@CaerusKaru please note the API Documentation here lists fxLayoutWrap under the 'Containers' section with no indication that is now deprecated. I just spent several hours trying to find out why it didn't work 😄 |
@chriscurnow I apologize for the lapse in the documentation. It has indeed been updated and removed, but the Wiki gets updated from source with every release, instead of with every PR (to allow us to avoid cluttering the history and revert/patch if necessary). The Wiki is planned for a refresh with the next release next Thursday if everything goes as scheduled. The source for the docs is in the docs directory in the repo. Again, apologies for the confusion. |
@CaerusKaru thank you for sharing this information. Can you please also confirm if we should expect this issue to be resolved in next release? |
@naveedahmed1 It's definitely a priority, but the higher priority at the moment is getting a full SSR solution ready. The current goal is for the next release, but depending on other factors it may get bumped to the next release. The current accepted workaround is to downgrade to the nightly build you indicated (or manually add the necessary CSS) |
The fix for this, while really annoying to track down, is simple and stems from an issue with the underlying DOM representation Angular uses on the server (aka Domino). The internal method we were using to track styles accounted for this, but since it's internal we could no longer rely on it. #590 adds another method for overcoming this deficiency in a not-hacky way. Hopefully it will be merged this week, but the next release might be pushed back. |
Thank you so much @CaerusKaru for the update and sharing the details :) One more thing, though not directly related to this issue, but since I am uncertain if it worth opening a new issue for this or not so adding it here. Since the |
@naveedahmed1 That's the gist of #567, though combining classes is something I hadn't considered. The solution involves generating one class per element so that we can track the responsive part correctly, I'll have to think about possibly combining classes for common styles. |
Awesome work @CaerusKaru ! It would be really great if the classes for the common styles could be combined. I just check a page on my site and it had 212 occurrences of inline style Looking forward :) |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When using
fxLayoutWrap
with Server Side Rendering, all elements are always shown in one row. With 2.0.0-beta.9 it was working perfectly but its broken in latest nightly update.The text was updated successfully, but these errors were encountered: